On Wednesday, April 20, 2016 at 2:31:39 PM UTC+2, Andrew wrote:
You are right, I really went at this from the wrong angle. Ok, so I would like to have slider or toggle buttons that when clicked, they reveal some text. The problem is that in order to be able to reset all of them with a reset button, I had to store the targets of buttons in fields of a temp tiddler using a global macro. Reset, basically deletes the temp tiddler. I would like to figure out a macro that uses the button name so I can define one button and reveal and then transclude several times and each with the names of the toggle buttons. I'm probably trying to get macro results from within another macro. Not possible right?
Let me recap, so I can see if I did understand it.
- "Some content" should be shown/hidden with the help of a toggle button
- There should be a "reset button" that deletes all state tiddlers
- The tiddler content, to modify the states should be relatively easy to read.
some questions
1) What do you mean with "some content"?
Since TW is highly optimized for tiddlers. As in "the tiddler is the thing" for me "some content" means tiddler content. So it will be easy to transclude. eg: with a macro like this: <<toggleMe tiddlerName>>
2) should the state "show/hide" tiddlers be persistent between sessions
This is important, since we need to know if we use "state" or "temp" variables
3) Are there any sliders, that need to be open by default
This makes a difference for the macro code
---------------
I'm thinking about a maro like this
<<toggleMe tiddlerName>> produces 2 buttons [show] / [hide]
[show] / [hide] replace each other when active
possible state tiddler names are:
- $:/state/toggleMe/tiddlerName for session persistent tiddlers
- $:/temp/toggleMe/tiddlerName for temporary state tiddlers
<<resetMe>> will delete all state or temp tiddlers with one click, so all "sliders" are closed
There may be "groups of sliders" eg: <<toggleMe tiddlerName groupName>>
so <<resetMe groupName>> just deletes all states that belong to one group
eg:
<<toggleMe asdf>> uses a state tiddler $:/state/toggleMe/-asdf
<<toggleMe aaaa group:mario>> uses a state tiddler $:/state/toggleMe/mario-aaaa
<<toggleMe bbbb group:mario>> uses a state tiddler $:/state/toggleMe/mario-bbbb
so
<<resetMe group:mario>> deletes all states that start with tiddler $:/state/toggleMe/mario
I'm testing this idea at the moment. ... The funny thing is, that the code is actually simpler than this description :)
feedback needed
have fun!
mario