How to make multiple "reveals" in one tiddler so that they work independently?

102 views
Skip to first unread message

Petri M.

unread,
Sep 9, 2021, 5:56:13 AM9/9/21
to TiddlyWiki
I can't figure this one out. So, I have a sidebar search tiddler where I want to show three different kinds of searches at the same time but I want each of them to be collapsable for easy navigation. I got everything else working fine but I cannot figure out how to get them to collapse and expand independently.

The "reveal" widget combined with "qualify" seems to be used quite commonly, but in order for "qualify" to give independent values it has to be transcluded from somewhere else. This does not seem to work for me because if I transclude my list then it just breaks entirely. I think this is due to $(searchTiddler) not having a value outside of the tiddler or something.

Anyway, then I thought that I should be able to just ditch the "qualify" and use standard tiddlers as states? But the exact same issue happens.

So if I have something like

<$button class="sidebar-collapsible" selectedClass="sidebar-collapsible-onclick" popup="test1">
Title matches:
</$button>
<$reveal type="match" state="test1" text="">
...
</$reveal>

<$button class="sidebar-collapsible" selectedClass="sidebar-collapsible-onclick" popup="test2">
Title matches:
</$button>
<$reveal type="match" state="test2" text="">
...
</$reveal>

they do not work independently. I checked that the "test1" and "test2" are created and removed when I click the buttons but they cannot both be "on" at the same time (collapsed).

Can I get some help here? I feel like this should be a simple thing but it has taken me way too long already.

Thanks,
Petri

Eric Shulman

unread,
Sep 9, 2021, 9:31:19 AM9/9/21
to TiddlyWiki
On Thursday, September 9, 2021 at 2:56:13 AM UTC-7 Petri M. wrote:
I can't figure this one out. So, I have a sidebar search tiddler where I want to show three different kinds of searches at the same time but I want each of them to be collapsable for easy navigation. I got everything else working fine but I cannot figure out how to get them to collapse and expand independently.

Popups are intended to appear only when the corresponding state tiddler has a value and the TWCore system automatically dismisses popups when it detects a click elsewhere.

However, your goal is to have an "anti-popup" that has the inverse behavior... i.e., it defaults to being visible unless the state tiddler value is set by a button click, and then remains that way until the button is clicked again.  The solution is to not use popups at all.  Instead, you want the button to simply toggle the state tiddler between blank and non-blank and then use that value to determine when to show the associated content.

Here's one way to write this using set/setTo and a "filtered transclusion" to calculate the desired state value:

<$button class="sidebar-collapsible" selectedClass="sidebar-collapsible-onclick"
   set="test1" setTo={{{ [{test1}match[hide]then[show]else[hide]] }}}>Title matches:</$button>
<$reveal state="test1" type="nomatch" text="hide"> ... t1 </$reveal>

<$button class="sidebar-collapsible" selectedClass="sidebar-collapsible-onclick"
   set="test2" setTo={{{ [{test2}match[hide]then[show]else[hide]] }}}>Title matches:</$button>
<$reveal state="test2" type="nomatch" text="hide"> ... t2 </$reveal>

Note: The current value of the state tiddlers will be retained when you save your file.  However, if you want the state tiddlers to be reset when you save the file, name them starting with "$:/state/popup/".  By default, tiddlers with that prefix are not retained when the file is saved.

enjoy,
-e

Petri M.

unread,
Sep 10, 2021, 6:22:52 AM9/10/21
to TiddlyWiki
Oh my god THANK YOU this was driving me nuts. I read that the popups are dismissed on click but I thought that you need to click the popup itself to dismiss it and I just never realised that you really do not have to.

Just one question, if I understand correclty the setTo=... is just a filter that checks whether the value of test1 is "hide", if it is, it outputs "show", if not then it outputs "hide". However, why do we need the triple braces around the filter?

BR,
Petri

Eric Shulman

unread,
Sep 10, 2021, 10:11:55 AM9/10/21
to TiddlyWiki

If there were were simple quotes around the filter, then it would be treated as a literal text value. The triple braces indicate that the parameter is using a “filtered transclusion” (aka, “inline filter”) and needs to be processed to get it’s actual value.

Note that, when used in normal wikitext content, the results of a filtered transclusion can return multiple values that are treated as a list of links. However, when a filtered transclusion is used as parameter in a $widget, only the first item in the list is used as the parameter value.

To see the difference, put the following content into a tiddler at http://TiddlyWiki.com

{{{ [tag[HelloThere]] }}}

<$text text={{{ [tag[HelloThere]] }}}/>

-e

P M

unread,
Sep 11, 2021, 4:27:28 PM9/11/21
to tiddl...@googlegroups.com
Ah I see now, thanks for the clarification!

-Petri

--
You received this message because you are subscribed to a topic in the Google Groups "TiddlyWiki" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tiddlywiki/pjT4iV_wHE4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tiddlywiki+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/53721910-ad92-4c66-8266-075a2548cfdcn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages