Hi, I was working with an EditorToolbar button whose dropdown I wanted to have two or more states handled with a $radio
widget, to switch between them.
I don’t like defining an external state tiddler when it’s not needed (maybe it’s a bad habit, but in this in this isolated case I wanted to use a field to store information about the state of the $radio
)
-So:
<$tiddler tiddler="$:/sob/EditorToolbar/Dropdown/x">
<$radio field="radio" value="1"> Page1</$radio>
<$radio field="radio" value="2"> Page2</$radio>
</$tiddler>
No problem so far.
But when I came to define a $reveal
that uses the value of the “radio” custom field (“1” or “2”) I got stuck.
I recalled that the documentation listed more than one way to define the state of the $reveal
widget:
https://tiddlywiki.com/#RevealWidget
In fact, here is the “stateField” attribute, which, based on the name, seems to be useful for my case. The documentation explains that:
A field name which is used to look for the state, if the attribute
stateTitle
is present
And about the “stateTitle”
A title containing the state, without TextReference. Gets preferred over the
state
attribute
So based on what I did understand here is what I tried:
<$reveal stateTitle="$:/sob/EditorToolbar/Dropdown/x" stateField="radio" type="match" text="1" animate="yes">
{{$:/sob/EditorToolbar/Dropdown/x/page1}}
</$reveal>
<$reveal stateTitle="$:/sob/EditorToolbar/Dropdown/x" stateField="radio" type="match" text="2" animate="yes">
{{$:/sob/EditorToolbar/Dropdown/x/page2}}
</$reveal>
But nothing is shown, regardless of the value of the “radio” field.
I must have done something wrong. Unfortunately the documentation about “stateTitle” and “stateField” stops there, and among the examples, there are none that use them. Nor have I found examples online that use them.
- Could you tell me where I went wrong?