Hi cmari
I don't know what you are trying to achieve, but there's also a 'find and
replace' option for the <$mangletags> widget. Your code using two widgets
will add 'newtag' regardless of whether the tiddler was previously tagged
with 'oldtag' -- with the find and replace option, 'newtag' will be added
only to those tiddlers that were previously tagged 'oldtag'.
The syntax in this case: <$mangletags find="oldtag" add="newtag">
The widgets may be used in any order -- however, the default behaviour in
most cases is to pass on the received message to the next widget in the
stack. it is easier, therefore, to stack widgets of the same type adjacent
to one another -- changing the message only when the widget type changes
(as you have done.) The <$maketid> widget is the exception, as the
parameter caught by the widget becomes the default for the template
(maintaining compatibility with the standard 'tw-new-tiddler' message) --
and the generated parameter is set to the value of the 'title' attribute.
All of the other widgets pass on the title of the target tiddler as the
parameter to the message by default (unless changed with 'param='), and
pass on the same message by default (unless changed with 'message='.)
Hope this better explains how to use the widgets.
regards
On Tuesday, June 3, 2014 7:33:28 PM UTC+2, cmari wrote:
>
> Knowing that it was possible gave me the fortitude to continue with my
> trial-and-error flailing!
> I still don't quite understand the pattern for which macro to use first
> and when to add which message where, but in case it's helpful for someone
> else, here's my working solution to accomplish the following with a single
> button:
> 1. set a field
> 2. set another field
> 3. add one tag
> 4. remove another
>
> <$setfield set="!!field1" setTo="value1">
> <$setfield set="!!field2" setTo="value2">
> <$mangletags find="oldtag" message="tw-set-field">
> <$mangletags add="newtag">
> <$button message="tw-mangle-tags">button text here</$button>
> </$mangletags></$mangletags></$setfield></$setfield>
>
> (I haven't included a target because I put this in a tiddler called
> MyButton and then use it inside other tiddlers, e.g., {{!!title||MyButton}}
> )
>
> This is really helpful - thanks!
> cmari
>
--
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 http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.