Reveal according to a variable?

The reveal widget has a range of state parameters but they only include;

Attribute Description
state A TextReference containing the state
stateTitle A title containing the state, without TextReference. Gets preferred over the state attribute
stateField A field name which is used to look for the state, if the attribute stateTitle is present
stateIndex An index which is used to look for the state, if the attribute stateTitle is prese
  • I only just discovered you can copy and past tables from tiddlywiki to here, cool

I have been researching ways to handle if then else functions, widgets etc… due to this conversation Proposed $if widget - #20 by CodaCoder

The Question arises is there a reason we could not introduce a stateVarable that the reveal widget could use to compare instead of only a reference to a tiddler or field?

  • Setting a state tiddler or variable requires a trigger to change, and I could see value in also allowing the state to be evaluated by a procedure or function or $set, $let $vars.
  • This would support my endevor to make a if then else and case statement from procedures and or functions. The key value of reveal is you can place it anywhere in a tiddler with the logic elsewhere.

Instead of specifying a state (or stateTitle + stateField/stateIndex), you can use the default param to specify a variable, like this:

<$reveal default=<<somevariable>> type="match" text="somevalue">
...
</$reveal>
2 Likes

Thanks @EricShulman so I suppose the answer is yes, we could have a stateVariable parameter and do of sorts already.

Note that the same conditional logic can also be achieved with a $list widget, like this:

<$list filter="[<somevariable>match[somevalue]]" variable=none>
...
</$list>
1 Like

Yes, thanks for adding that. That is my usual approach, my interest is leveraging the tag, type and text parameters and popups / animation etc…