variable and state tiddler

58 views
Skip to first unread message

Mohammad

unread,
Jul 20, 2019, 10:22:02 PM7/20/19
to TiddlyWiki
Some widgets use state tiddlers to store a state for further operations!
My question is can we use state variable instead of state tiddler / state field?
The benefit is you dont need anymore to create new tiddler, have unique tiddler and so on

for example
<$vars myvar="yes" >


<$button set=<
<stVar>> setTo="no" ....


<$reveal type=match state=<
<stVar>> ...
.
.
.
</$vars>





--Mohammad

Mohammad

unread,
Jul 20, 2019, 10:28:33 PM7/20/19
to TiddlyWiki
Example
 Create a tiddler in https://tiddlywiki.com/
and put below script inside the it and save!

<$vars stVar="show">

<$button set=<<stVar>> setTo="show">Show me</$button>
<$button set=<<stVar>> setTo="hide">Hide me</$button>

<$reveal type="match" state=<<stVar>> text="show">

! This is the revealed content
And this is some text

</$reveal>


You will see it works. If so, I think in some part we can remove the use of state Tiddler and qualify macro and like that!
I know if scripts work in different scope still we need global variables and we have to use the state tiddler / state field and state index!

What do you think?


--Mohammad

Mohammad

unread,
Jul 20, 2019, 11:53:20 PM7/20/19
to TiddlyWiki
Note
 This is a proposal! Note that TW still creates a state tiddler here it creates a tiddler show and hide!
My proposal is to remove needs for state tiddlers in such a case!

--Mohammad

PMario

unread,
Jul 21, 2019, 1:18:17 AM7/21/19
to TiddlyWiki
Hi,

IMO this doesn't make sense. The good thing for TW is, that the internal state can be 100% controlled with tiddlers. Everything can be controlled using tiddlers.

It would be a huge regression, if this functionality would be lost.

have fun!
mario


PMario

unread,
Jul 21, 2019, 1:18:54 AM7/21/19
to TiddlyWiki
Hi,
How can you control the reveal state from the sidebar???
-m

Mohammad

unread,
Jul 21, 2019, 1:55:24 AM7/21/19
to TiddlyWiki
Hi Mario
 Thanks for your reply! I know for for global variable (state) we need something like state tiddler!
My question was to have state var for simple cases like in place toggle button! This avoid creating extra tiddlers!

--Mohammad

PMario

unread,
Jul 21, 2019, 2:45:34 AM7/21/19
to TiddlyWiki
On Sunday, July 21, 2019 at 7:55:24 AM UTC+2, Mohammad wrote:
 Thanks for your reply! I know for for global variable (state) we need something like state tiddler!
My question was to have state var for simple cases like in place toggle button! This avoid creating extra tiddlers!

Why do you want to avoid extra tiddlers? ... The disadvantages outwight the advantages by far.

For me there is no "simple case" ... It may be simple for one user, but for an other user it's important to change the state from an action-widget button somewhere else on the page. So the access has to be consistent all the time.

-m

Mohammad

unread,
Jul 21, 2019, 6:41:39 AM7/21/19
to TiddlyWiki
Thanks Mario!

Simple logic, simpler programming, make it easier to understand and maintain!

By the way, it seems as far as compatibility and less diversity is a concern, It may be better to stick to current syntax and feature!

Cheers
Mohammad
Reply all
Reply to author
Forward
0 new messages