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 tiddlywiki+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/eec4080e-30fc-4894-80e1-52b346c68c0dn%40googlegroups.com.