A quick note - back on the original post.

The Need to remove one tag when adding another to toggle a state needs to 
occur everywhere in the wiki the same way or you may end up with both or 
neither.

This is why I tend to move it to a common field name with one of the 
possible values only permitted at a time.

Once you become used to has[fieldname] get[fieldname] {{!!fieldname}} 
has:field[fieldname]] its easier than managing tag toggles and can protect 
you from the inconsistencies allowing only one value at a time.

Regards
Tony

On Thursday, January 10, 2019 at 9:12:41 PM UTC+11, Mohammad wrote:
>
> Great solution Thomas. There is small typo I corrected below
>
> \define BtnTagListops(btntext,add-
>
> remove,tooltip)
> <$button tooltip="""$tooltip$""">
> <$wikify name="timestampState" text="{{$:/config/TimestampDisable}}">
> <$action-setfield $tiddler="$:/config/TimestampDisable" $value="yes"/>
> <$action-listops $tags="$add-remove$" />
> $btntext$
> <$action-setfield $tiddler="$:/config/TimestampDisable" $value=<<
> timestampState>>/>
> </$wikify>
> </$button>
> \end
>
> Calling macro
>
> \define todoBtnDoNow()
> <$wikify name="tt" text="switch tags">
>    <$macrocall $name="BtnTagListops" btntext="Do this now" 
> add-remove="ToDoNow 
> -ToDo" tooltip=<<tt>>/>
> </$wikify>
> \end
>
>
> In the second script (calling macro, the correct $name="BtnTagListops" 
> instead of teBtnTagListops.
>
>
> Cheers
> Mohammad
>
>
>
> On Sunday, August 5, 2018 at 5:40:19 PM UTC+4:30, Thomas Elmiger wrote:
>>
>> Hi folks,
>>
>> I use the fabulous listops action for this (a bit complicated but 
>> reusable):
>>
>> \define BtnTagListops(btntext,add-remove,tooltip)
>> <$button tooltip="""$tooltip$""">
>> <$wikify name="timestampState" text="{{$:/config/TimestampDisable}}">
>> <$action-setfield $tiddler="$:/config/TimestampDisable" $value="yes"/>
>> <$action-listops $tags="$add-remove$" />
>> $btntext$
>> <$action-setfield $tiddler="$:/config/TimestampDisable" 
>> $value=<<timestampState>>/>
>> </$wikify>
>> </$button>
>> \end
>>
>> This does change tags WITHOUT updating timestamps (it stores and restores 
>> the previous setting for updating timestamps). I call it from other macros 
>> like this one:
>>
>> \define todoBtnDoNow()
>> <$wikify name="tt" text="switch tags">
>>    <$macrocall $name="teBtnTagListops" btntext="Do this now" 
>> add-remove="ToDoNow -ToDo" tooltip=<<tt>>/>
>> </$wikify>
>> \end
>>
>> <<todoBtnDoNow>> adds the tag ToDoNow and removes the tag with the minus 
>> (-) ToDo. You could add and remove as many tags as you like. 
>>
>> These are somewhat simplified macros, I hope they still work and it is 
>> clear how they work. 
>>
>> Cheers, 
>> Thomas
>> (Back from offline vacation.) 
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" 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/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/1ffb599b-12f1-4213-9508-cd4f4f269887%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to