How to update state within a macro?

89 views
Skip to first unread message

Steven Schneider

unread,
May 30, 2017, 2:31:14 PM5/30/17
to TiddlyWiki
I'm not even sure I'm asking the right question:

I have two slideshow macros that invoke a slideshow, and then return to the regular wiki.  The slideshow macro changes theme, tags a few buttons so they become visible in view template, and then launches the slideshow with all tiddlers matching the specified tag. The slideshow is supposed to end with a tiddler that has a "Return to Wiki" button, that invokes the endslideshow macro, changing the theme back, untagging the buttons.

The trouble I am having is that I add the tag to the "end slide show" tiddler, but of course it hasn't saved back to the wiki, so that my list filter doesn't capture it, and I never get the end button.

Is there a command I can use that will save the wiki before I call the list filter?

Thanks,

//steve.

(oh, and perhaps someone can explain the benefit/cost of using action-setfield v. action-listops...)


\define slideshow(slidetag)
<$set name="slidetag" value="$slidetag$">
<$button set="$:/state/sidebar" setTo="no" tooltip={{$:/language/Buttons/HideSideBar/Hint}} aria-label={{$:/language/Buttons/HideSideBar/Caption}} >
<$action-sendmessage $message="tm-close-all-tiddlers"/>
<$action-setfield $tiddler="$:/theme" text="$:/themes/tiddlywiki/punch"/>
<$action-setfield $tiddler="$:/core/ui/ViewTemplate/next" tags="$:/tags/ViewTemplate"/>
<$action-setfield $tiddler="$:/core/ui/ViewTemplate/prev" tags="$:/tags/ViewTemplate"/>
<$action-listops $tiddler="ZZZEndSlides" $field="tags" $subfilter=$slidetag$/>
<$list filter="[tag<slidetag>!sort[]]">
<$action-navigate $to=<<currentTiddler>> />
</$list>
View Slides tagged with <<slidetag>>
</$button>
</$set>
\end

\define endslideshow()
<$button set="$:/state/sidebar" setTo="yes"> 
<$action-setfield $tiddler="$:/theme" text="$:/themes/tiddlywiki/heavier"/>
<$action-listops $tiddler="$:/core/ui/ViewTemplate/next" $field="tags" $filter="[[]]"/>
<$action-listops $tiddler="$:/core/ui/ViewTemplate/prev" $field="tags" $filter="[[]]"/>
<$action-listops $tiddler="ZZZEndSlides" $field="tags" $filter="[[]]"/>
<$action-sendmessage $message="tm-close-all-tiddlers"/>
<$action-navigate $to="HelloThere"/>
Return to the wiki
</$button>
\end


Thomas Elmiger

unread,
May 31, 2017, 9:44:45 AM5/31/17
to TiddlyWiki
Hi Steve,

I think you could adapt your filter to always include the end-tiddler and it would work. Something like

<$list filter="[[$:/core/ui/ViewTemplate/endslideshow]] [tag<slidetag>!sort[]]">



Good luck!
Thomas

Thomas Elmiger

unread,
May 31, 2017, 5:02:36 PM5/31/17
to TiddlyWiki
Steve,

this concept is so cool, that I had to draft my own adaption. I have removed the Punch theme (because I don’t know how to adapt this) and included my own stylesheet instead (based on Punch).

Among my other tweaks is (so I believe) the solution to your styling question for the close-button. I post my change here, because it is connected to the code you present above. You can make the button appear as an anchor, then it is the same as the arrows:

<$button tag="a" set="$:/state/sidebar" setTo="yes">

(Personally I think the cross is too big now.) You can find my draft here: https://tid.li/tw5/styles.html#Slideshows – a click on the tag pill SimpleSlides shows all relevant components.

All the best for your presentation!
Thomas

Thomas Elmiger

unread,
May 31, 2017, 5:20:54 PM5/31/17
to TiddlyWiki
I just realize that my button has classes too …

<$button tag="a" set="$:/state/sidebar" setTo="yes" class="tc-btn-invisible tc-tiddlylink">
Reply all
Reply to author
Forward
0 new messages