[tw5] Need help getting a button to function

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

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.

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