Specify in link if tiddler should open above or below current

71 views
Skip to first unread message

Anjar

unread,
May 23, 2021, 10:53:40 AM5/23/21
to TiddlyWiki
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>

Best,
Anders

PMario

unread,
May 23, 2021, 11:43:24 AM5/23/21
to TiddlyWiki

PMario

unread,
May 23, 2021, 11:48:13 AM5/23/21
to TiddlyWiki
Hi,
I was sure, that we had a tv-xxx variable to control the behaviour. ... We don't have one ... I'm probably thinking of one of my experiments.
I'll have to have a closer look.

On Sunday, May 23, 2021 at 4:53:40 PM UTC+2 Anjar wrote:

Eric Shulman

unread,
May 23, 2021, 11:50:27 AM5/23/21
to TiddlyWiki
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

Anjar

unread,
May 23, 2021, 3:36:23 PM5/23/21
to TiddlyWiki
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

Mohammad Rahmani

unread,
May 23, 2021, 3:54:14 PM5/23/21
to tiddl...@googlegroups.com
Anders,

 Have you seen the simple-navigation in the Utility plugin?
  What you need is Next|Previous button plus opening in next previous position in story river am I right?

If so, hack the Utility plugin and add one more action as below
1. for the previous button add the opening tidder to $:/StoryList  (list field) using putbefore 
2. for the next button add the opening tidder to $:/StoryList  (list field) using putafter

This way when a tiddler is open in the story river, Next button opens the next tiddler below current and Previous button opens previous tiddler before current tiddler!



Best wishes
Mohammad


--
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+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/30882e1f-bbc9-46c6-b57e-1bb997bc21e4n%40googlegroups.com.

Anjar

unread,
May 23, 2021, 4:57:22 PM5/23/21
to TiddlyWiki
Hi Mohammad,

This worked perfectly, thank you very much!


Best,
Anders

Reply all
Reply to author
Forward
0 new messages