Thanks Eric! This is a very clever solution and it will work perfectly for me. Much appreciated, Alan
On Wednesday, December 11, 2019 at 10:51:32 PM UTC-6, Eric Shulman wrote: > > On Wednesday, December 11, 2019 at 8:12:49 PM UTC-8, Alan Aldrich wrote: >> >> Mark, there is no issue with the action widgets. In fact try this in the >> above code: replace the value in the set widget with "some static text". >> Everything works as expected. That is, the setfield action sets the text >> of the new tiddler to <<table "some static text">> then navigates to it, >> then deletes the temp tiddler. The issue appears to be with the set widget. >> It is as if the set widget is parsed prior to any action widgets regardless >> of its location inside the button. >> > > Button actions can be subtle, especially when you are depending upon > intermediate results *during* the processing of the actions. > > Fortunately, there IS a solution to your problem: > > You can get the results you want if you split the button processing into > two parts: > (1) create the new tiddler, and > (2) set the contents, show the tiddler, and cleanup the temp > > Part(1) of the processing is in the body of the $button widget. > Part(2) of the processing is done using the $button widget's "actions" > param. > > Although Part(1) is not invoked until the button is pressed, it is > *parsed* when the $button widget is rendered. > However, because Part(2) is done via a separate "actions" param, it is not > even *parsed* until the button is actually pressed. > As a result, Part(1) processing is completed before Part(2) is parsed AND > invoked. > This allows Part(2) to use the contents of $:/temp/title that were set > during Part (1). > > Give this a try: > \define newTableText() > <<table "$(newTableTitle)$">> > \end > > \define makeNewTable() > <$set name="newTableTitle" value={{$:/temp/title}} > > <$action-setfield $tiddler={{$:/temp/title}} text=<<newTableText>>/> > </$set> > <$action-navigate $to={{$:/temp/title}}/> > <$action-deletetiddler $tiddler="$:/temp/title"/> > \end > > <$button actions=<<makeNewTable>>> > New Table > <$action-createtiddler $basetitle="New Table" $savetitle="$:/temp/title" > /> > </$button> > > let me know how it goes, > > enjoy, > -e > > -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/15c400ba-6fd8-4f7e-98a0-2c1e6ed5ef5d%40googlegroups.com.