Hi Scott

Before the introduction of the ActionListops widget in v5.1.10 -- the only 
option to add or remove a tag using a button were the 'tm-add-tag' and 
'tm-remove-tag' messages in conjunction with an enclosing FieldMangler 
widget (unless it were permissible to overwrite the 'tags' field with an 
ActionSetfield widget.)

The ActionListops widget is not only simpler to use in simple cases (action 
widgets are generally more straightforward to use than widgets based on 
widget messaging) -- but also allow many versatile options for manipulating 
the 'tags' or any other list in any field or index. 

For the simple usage case of adding and removing a tag (mimicking the 
MangleTags functionality), the default field reverts to 'tags':

<$button>
<$action-listops tiddler="Target Tiddler" $tags="[[Tag to Add]] -[[Tag to 
Remove]]"/>
Tag</$button>

If the tags don't contain spaces, then the double brackets are unnecessary:

<$button>
<$action-listops $tiddler="Target Tiddler" $tags="AddTag AndAnother 
-RemoveTag -RemoveAnotherTag"/>
Tag</$button>

Compare with:

<$fieldmangler tiddler="Target Tiddler">
<$button>
<$action-sendmessage $message="tm-add-tag" $param="AddTag"/>
<$action-sendmessage $message="tm-add-tag" $param="AndAnother"/>
<$action-sendmessage $message="tm-remove-tag" $param="RemoveTag"/>
<$action-sendmessage $message="tm-remove-tag" $param="RemoveAnotherTag"/>
Tag</$button>
</$fieldmangler>

In some cases, a simple filter expression can allow greater brevity e.g. to 
clear all non-system tags (keep system tags) -- and add new tags:

<$button>
<$action-listops $tiddler="Target Tiddler" $tags="+[prefix[$:/]] MyNew 
Tags"/>
Tag</$button>

Therefore, an apparent advantage to learning the workings of the 
ActionListops widget. The downside -- new to the core; may have bugs in 
edge cases.

regards

On Tuesday, 12 January 2016 06:42:44 UTC+2, Scott Simmons (Secret-HQ) wrote:
>
> Hmmmm.
>
> Any thoughts on the various advantages/disadvantages of using 
> <$action-listops> vs. <$fieldmangler> and <$action-sendmessage>?
>

-- 
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/cc621c6b-a308-4c02-8475-6d6a4aaf7f00%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to