Since the checkbox flips the state field before calling actions, you could 
use a reveal widget to limit the actions to either one state or the other. 
Like:

\define myactions()
<$reveal state="mystate!!checked" type="match" text="YES">
<$fieldmangler>
<$action-setfield  $field="tags" $value=<<tag>> /><$action-sendmessage 
$message="tm-add-tag" $param=<<tag>> />
</$fieldmangler>
</$reveal>
\end

<$set filter="[[Features]] [[Encryption]] +[tags[]]" name="tag">
<$checkbox actions=<<myactions>> tiddler="mystate" field="checked" checked=
"YES" unchecked="NO" >
    Add tags from tiddlers [[Features]] and [[Encryption]]
</$checkbox>
</$set>

It seems to work in my tests. On the first click it sets the tags as 
expected. Open the tiddler. Delete the tags. Close the tiddler Now uncheck 
the box, and tags are not added back.

-- Mark

On Friday, July 27, 2018 at 1:57:47 AM UTC-7, Hubert wrote:
>
> Hi all,
>
> We can now assign actions to checkboxes that will be triggered when 
> checking/unchecking the checkbox, as in this example 
> <https://tiddlywiki.com/static/CheckboxWidget.html>.
>
> It seems that (by design?) the same assigned set of actions will be 
> triggered whether the checkbox is checked or unchecked.
>
> Has anyone found a way to assign a *different *set of actions depending 
> on whether the checkbox is checked or unchecked (one set of actions for 
> 'checked', another one for 'unchecked')?
>
> Thank you!
>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
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/c3e2e79b-3768-4e50-ab32-5b0cf7380adb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to