On Thursday, December 17, 2020 at 4:07:38 PM UTC-8 Mark S. wrote:

> In prerelease 5.23, if I run something like:
> <$action-createtiddler $basetitle="Excerpt" $savetitle="$:/savedtitle" 
> tags="Excerpt" text=<<actionText>> />
> The title saved in $:/savetitle doesn't become available until AFTER the 
> routine it is in finishes. This means it is too late to be used by other 
> widgets inside of the same routine/macro.
> I feel like this problem was encountered before, and there was some sort 
> of fix for it. Does anyone remember what that might be? Or if it's 
> something that's a known problem?
>

A $button can actually invoke two sets of action widgets:

First, when clicked, any action widgets that occur in the body of the 
button are invoked.
Then, if the $button has an actions="..." parameter, those actions are 
invoked afterwards.

Thus, you can do something like:

<$button actions="""<$action-setfield $title={{$:/savedtitle}} ... />""">
   click me
   <$action-createtiddler $basetitle="..." $savetitle="$:/savedtitle" 
etc... />
</$button>

note that, for readability, you could also define separate macros for each 
set of actions, and then invoke them like this:

\define buttonactions_1() <$action-createtiddler $basetitle="..." 
$savetitle="$:/savedtitle" etc... />
\define buttonactions_2() <$action-setfield $title={{$:/savedtitle}} ... />

<$button actions=<<buttonactions_2>>> click me <<buttonactions_1>> 
</$button>

-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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/a611aa74-c489-4c02-900b-78c56542566dn%40googlegroups.com.

Reply via email to