For those received this post by email! Please see the original post! It has been edited and two codes have been attached!
--Mohammad On Thursday, July 4, 2019 at 9:22:01 AM UTC+4:30, Mohammad wrote: > > Hello Jeremy, > I made an experiment and share the code here! > Amazingly your instruction works and let me switch values! > > I have attached the example and added to TW-Scripts for future use! > The is as below > > \define switch() > <$action-setfield $tiddler="exmp66/temp" $value={{exmp66/data!!fa}} /> > <$action-setfield $tiddler="exmp66/data" $field="fa" > $value={{exmp66/data!!fb}} /> > <$action-setfield $tiddler="exmp66/data" $field="fb" > $value={{exmp66/temp}} /> > \end > > <$button actions=<<switch>> >Exchange fields value > </$button> > > The above code assume you have exmp66/data tiddler with two fields fa and > fb containing different things. > > > In Part two, I have used a select widget and did the below operation > > * A <--- B > * B <---- new value > > The code is as below > > \define switch() > <$action-setfield $tiddler="myTid" $field="fa" $value={{stateTid}} /> > <$action-setfield $tiddler="myTid" $field="fb" $value="$(Temp)$" /> > \end > > <$set name=Temp tiddler="myTid" field="fa"> > Select a value and watch [[myTid]] > > <$select tiddler='stateTid' > actions=<<switch>> > > > <$list filter='One Two Three Four Five'> > <option><$view field='title'/></option> > </$list> > </$select> > </$set> > > A code has been attached to reproduce the result > > Cheers > Mohammad > > On Wednesday, July 3, 2019 at 9:56:09 PM UTC+4:30, Jeremy Ruston wrote: >> >> 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. >> >> 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 <https://tiddlywiki.com/prerelease/#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. >>> 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 >>> >>> <https://groups.google.com/d/msgid/tiddlywiki/94e81452-52fc-41ec-a022-ecd973e5829d%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> For more options, visit https://groups.google.com/d/optout. >>> >>> >>> >> -- >> 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. >> 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/c35746e1-b914-4162-b610-679692161491%40googlegroups.com >> >> <https://groups.google.com/d/msgid/tiddlywiki/c35746e1-b914-4162-b610-679692161491%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> >> >> -- 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+unsubscr...@googlegroups.com. To post to this group, send email to tiddlywiki@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/d197356f-736d-40e5-bbfd-bc6848cdcae0%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.