Need help getting a button to function

20 views
Skip to first unread message

Robert Payne

unread,
May 5, 2022, 10:16:29 AM5/5/22
to TiddlyWiki
Hi All,

I have added an Open All button to the Page Toolbar with a message attribute equal to tm-open-all-tiddlers.  Now, I need help getting the button to actually work.  What I want to do  when the button is clicked is go through all of the Default Tiddlers and add them to the Story River.  Thanks in advance for input.

--Robert

Télumire

unread,
May 5, 2022, 12:34:18 PM5/5/22
to TiddlyWiki
There is no "tm-open-all-tiddlers" message. See the list : https://tiddlywiki.com/#Messages

What you can do is use a list widget inside of a button widget, and loop trough a list of tiddler to open, then use an action-navigate widget to open each one. Assuming your list is in the list field of a tiddler named "DefaultTiddlers" :

<$button>
<$list filter="[list[DefaultTiddlers]]">
<$action-navigate $to=<<tiddler>>/>
</$list>
Open all
</$button>



You can also use a use a link
to do that :

<a href="#:[list[DefaultTiddlers]]"> Open all </a>

But this will close tiddlers that already are in the story. To prevent that, use this :

<a href="#:[list[$:/StoryList]] [list[DefaultTiddlers]]">Click to add the default tiddlers bellow the story</a>

or

<a href="#:[list[DefaultTiddlers]] [list[$:/StoryList]]"> Click to add the default tiddlers above the story </a>

If you want your link to look like a button :

<a href="#:[list[DefaultTiddlers]] [list[$:/StoryList]]"><$button> Click to add the default tiddlers above the story</$button> </a>


This is shorter than a list widget, but this will modify the url.

Télumire

unread,
May 5, 2022, 12:36:48 PM5/5/22
to TiddlyWiki
Erratum :

<$button>
<$list filter="[list[DefaultTiddlers]]">
<$action-navigate/>
</$list>
Open all
</$button>


No need to specify a target to the action navigate widget, it default to the current tiddler. Also I got the variable wrong, its <<currentTiddler>> and not <<tiddler>>.
More info here : https://tiddlywiki.com/#ListWidget
Reply all
Reply to author
Forward
0 new messages