Thank you both!

I tried your solution, @Eric, but it didn't seem to work; I tried to move 
<$action-navigate 
$to=<<previousTiddler>> /> into the body, but that didn't help either. So 
perhaps the problem is more complex than simply changing 
$:/config/Navigation/openLinkFromInsideRiver

However, this was a very interesting way to force a specific sequence of 
events!

Best,
Anders

søndag 23. mai 2021 kl. 17:50:27 UTC+2 skrev Eric Shulman:

> On Sunday, May 23, 2021 at 7:53:40 AM UTC-7 Anjar wrote:
>
>> Hi,
>> I have some tiddlers in sequence with links to previous/next at the 
>> bottom. To keep the order in the story, I want previous tiddlers to open 
>> above the current but he next to open below. Is it possible to achieve this 
>> in some way?
>> I tried this, but without success:
>>
>> <$button class="tc-btn-invisible tc-tiddlylink">
>> <$action-setfield $tiddler="$:/config/Navigation/openLinkFromInsideRiver" 
>> text="above"/>
>> <$action-navigate $to=<<previousTiddler>> />
>> <$action-setfield $tiddler="$:/config/Navigation/openLinkFromInsideRiver" 
>> text="below"/>
>> << Previous
>> </$button>
>>
>
> The problem is that button actions are not guaranteed to be processed in 
> the order they are listed.  This is because some actions (such as 
> $action-navigate) are handled asynchronously during the TWCore refresh 
> cycle.  In your example code, both setfield widgets are processed before 
> the navigate widget.  Thus, by the time the navigate widget is invoked, 
> "openLinkFromInsideRiver" has already been reset back to "below".
>
> However, there *is* a way to split the actions into two parts, so that the 
> first part is performed (and *completed*) before the second part is 
> invoked.  To do this, you use actions that are in the body of the $button 
> widget as well as the actions=... parameter of the $button widget.  The 
> "body" actions will be performed first, followed by the parameter actions.
>
> Try this:
> <$button class="tc-btn-invisible tc-tiddlylink" actions="""
>    <$action-navigate $to=<<previousTiddler>> />
>    <$action-setfield 
> $tiddler="$:/config/Navigation/openLinkFromInsideRiver" text="below"/>
> """>
> <$action-setfield $tiddler="$:/config/Navigation/openLinkFromInsideRiver" 
> text="above"/>
> << Previous
> </$button>
>
> 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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/30882e1f-bbc9-46c6-b57e-1bb997bc21e4n%40googlegroups.com.

Reply via email to