SelectWidget does actions before selection is set...?

86 views
Skip to first unread message

Mat

unread,
Jul 2, 2019, 11:03:56 AM7/2/19
to TiddlyWiki
The SelectWidget has a parameter named "tiddler" where the selected title is stored.

I want to perform an action to the selected item, so I'm using the SelectWidget action attribute.

However, when selecting a title in the list it seems the actions are performed before the title is added to the state tiddler.

How can the actions be made to affect the selected title?

(Currently, the first time the SelectWidget is used, it triggers an action without anything being set, as if it was a separate action widget button. And selecting a second title triggers the action to be performed on the first selection title - !?)

<:-)

Jeremy Ruston

unread,
Jul 2, 2019, 11:11:56 AM7/2/19
to tiddl...@googlegroups.com
Hi @twMat

I can confirm that the action string is in fact executed after the target tiddler has been set. The problem is subtler: any variables setup outside of the action string will not be updated to reflect the new value of the target tiddler. So you need to make sure you directly compute anything that depends on that tiddler.

Best wishes

Jeremy

--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/94e81452-52fc-41ec-a022-ecd973e5829d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mat

unread,
Jul 2, 2019, 11:20:17 AM7/2/19
to TiddlyWiki
Thank you for your reply! That is in deed subtle.

Just to make sure I understand; Here's the code here - are you saying it is the outer wikified variable that causes the problem and I should instead somehow move this into the actions argument?

<$wikify name=tid text={{$:/temp/addaliasfield}}>
<$select tiddler='$:/temp/addaliasfield' size='5'
         actions="""<$action-setfield $tiddler=<<tid>> $field=aliases $value="oo">"""
>
   <$list filter='[all[tiddlers]!is[system]!has:field[aliases]]'>
      <option><$view field='title'/></option>
   </$list>
</$select>
</$wikify>


<:-)

Jeremy Ruston

unread,
Jul 2, 2019, 11:24:17 AM7/2/19
to tiddl...@googlegroups.com
Hi Mat
That’s correct. The variable tid is inherited by the action string, but will not have been updated before execution. (One of the reasons is to avoid a potential inconsistency: a result of refreshing the tree to get that variable updated might plausibly be to cause that entire select widget to be removed from the tree).

You probably knew I was going to ask this, but what is the wikify widget here for? Why aren’t you using <$set name=tid text={{$:/temp/addaliasfield}}>?

Best wishes

Jeremy.



<:-)

--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.

Mat

unread,
Jul 2, 2019, 11:32:49 AM7/2/19
to TiddlyWiki
You probably knew I was going to ask this, but what is the wikify widget here for? Why aren’t you using <$set name=tid text={{$:/temp/addaliasfield}}>?

LOL! I copied it straight from where I have the problem (here) and if I recall I think I used wikify because I tried with some filter attribute in set which probably failed, i.e gave brackets, so resorted to wikify. 

But yes, it should be $set

Thanks for your valuable input.

<:-)

Mohammad

unread,
Jul 2, 2019, 12:02:55 PM7/2/19
to TiddlyWiki
Jeremy,
 Does this mechanism lets to switch two values!
Temp=A
A=B
B=Temp
If we select B  from select widget and set temp outside select widget?

--Mohammad


On Tuesday, July 2, 2019 at 7:41:56 PM UTC+4:30, Jeremy Ruston wrote:
Hi @twMat

I can confirm that the action string is in fact executed after the target tiddler has been set. The problem is subtler: any variables setup outside of the action string will not be updated to reflect the new value of the target tiddler. So you need to make sure you directly compute anything that depends on that tiddler.

Best wishes

Jeremy

On 2 Jul 2019, at 16:03, Mat <matia...@gmail.com> wrote:

The SelectWidget has a parameter named "tiddler" where the selected title is stored.

I want to perform an action to the selected item, so I'm using the SelectWidget action attribute.

However, when selecting a title in the list it seems the actions are performed before the title is added to the state tiddler.

How can the actions be made to affect the selected title?

(Currently, the first time the SelectWidget is used, it triggers an action without anything being set, as if it was a separate action widget button. And selecting a second title triggers the action to be performed on the first selection title - !?)

<:-)

--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddl...@googlegroups.com.

Jeremy Ruston

unread,
Jul 3, 2019, 1:26:09 PM7/3/19
to tiddl...@googlegroups.com
Hi Mohammad

 Does this mechanism lets to switch two values!

I guess you could indeed use the outer variable to give access to the previous value. I’m not sure that it would be the clearest way to express what’s going on, but it’s an interesting idea.

Best wishes

Jeremy.

To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.

To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.

Mohammad

unread,
Jul 3, 2019, 3:07:48 PM7/3/19
to TiddlyWiki
Thanks Jeremy!
I will make some experiments and will return with results.

Cheers
Mohammad
Hi Mohammad

Message has been deleted
Message has been deleted

Mohammad

unread,
Jul 4, 2019, 2:46:08 AM7/4/19
to TiddlyWiki
Please ignore the previous posts and consider these two online demo

These are demo of what we discussed with Jeremy


Cheers
Mohammad
Reply all
Reply to author
Forward
0 new messages