Navigate and close others?

69 views
Skip to first unread message

Scott Kingery

unread,
Jan 7, 2019, 7:59:56 PM1/7/19
to TiddlyWiki
I have a button to navigate back to my home tiddler
<$button to=Home >{{$:/core/images/home-button}} Home</$button>


Is it possible to build such a button that would open Home and close the rest?

Diego Mesa

unread,
Jan 7, 2019, 8:24:13 PM1/7/19
to TiddlyWiki
Hey Scott,

Sure! The code to do this is:

<$navigator story="$:/StoryList" history="$:/HistoryList">
    <$button class="tc-btn-invisible tc-tiddlylink">
        {{$:/core/images/home-button}} Home
        <$action-sendmessage $message="tm-close-all-tiddlers" />
        <$action-navigate $to="PLACE_TITLE_OF_HOME_TIDDLER_HERE"/>
    </$button>
</$navigator>


Explanation:
A working example:
<$navigator story="$:/StoryList" history="$:/HistoryList">
    <$button class="tc-btn-invisible tc-tiddlylink">
        {{$:/core/images/home-button}} Home
        <$action-sendmessage $message="tm-close-all-tiddlers" />
        <$action-navigate $to="ButtonWidget"/>
    </$button>
</$navigator>

Best,
Diego

Scott Kingery

unread,
Jan 8, 2019, 11:50:06 AM1/8/19
to TiddlyWiki
Diego,
Thanks for the code ant the explanation. Works great.

Scott

Mohammad

unread,
Jan 9, 2019, 12:45:32 AM1/9/19
to tiddl...@googlegroups.com
Diego,
 A neat script. My question is
  • why we need to use the $navigator widget?
  • If we remove the $navigator from above script, still the code works, so is it valid to remove the $navigator?

--Mohammad
Reply all
Reply to author
Forward
0 new messages