Mat,

This sounds like a good idea. I would only add the following.

Often such toggle Buttons actually consist of two buttons or images. One to 
toggle on and one to toggle off. And example may be a green and red button 
indicating the toggle state.

So perhaps what you ask for could be developed into a macro, that one 
allows you to define such toggle buttons that manipulate the same state 
reference as you use in the the reveal. Ideally we could pass the state 
tiddler and the on and off text or buttons, or even just a parameter or 
class to change colour of the button. By doing this we can reuse the same 
macro rather than needing to copy and modify it, however this could be 
useful if you want to add more action widgets to the toggles. By the way 
the toggle off can have an action widget to delete the state tiddler.

Regards
Tony


On Sunday, June 23, 2019 at 9:12:15 PM UTC+10, Mat wrote:
>
> Before I post this on gh, I'd like to hear what you think of the following 
> idea:
>
> "I want a button that does...."
>
> ...is a common need but requires a more involved process than should be 
> needed. For one thing, it often also requires the RevealWidget which is a 
> bit complex. In particular, if you want the "normal" look for a button, 
> namely *one* button that does both "on" and "off" (the "Accordion" example 
> <https://tiddlywiki.com/prerelease/#RevealWidget>) then you need to 
> create *two* buttons and *two* RevealWidgets. Way too complex.
>
> So to serve this common use case, could both of ButtonWidget + 
> RevealWidget use a default state tiddler like so "$:/state/<current>"? 
> Default values are perhaps *true* and *false*. And if this default state 
> is used, the RevealWidget further defaults to *type=match* and *text=true*
>
> This would allow for really simple syntax:
>
> <$button>Toggle</$button>
>
> <$reveal>
> Content
>
> </$reveal>
>
>
>
> So, this idea is really two individual proposals because of the typical 
> coexistence between the widgets:
>
> 1) Make the ButtonWidgets *set* and *setTo* have default values 
> *$:/state/<current>* and *true.* For this to be meaningful, the widget 
> must first check to see if this state tid is already set, in which case it 
> sets it to *false* or, perhaps better, deletes the state tid.
> The resulting state tiddler can of course be used for anything...
>
> 2) ...but, particularly for the RevealWidget; if no RevealWidget state 
> parameter is defined then default to *state=$:/state/<current>*  and 
> *type=match* and *text=true*
>
>
> <:-)
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tiddlywikidev.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywikidev/0fef3690-2f3d-400c-979b-4084f8702a22%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to