\define applyTag()
<!-- first remove tag -->
<$list filter="[search:title[exmp65/data]tag[exmp65]]">
<$fieldmangler>
<$action-sendmessage $message="tm-remove-tag" $param="exmp65"/>
</$fieldmangler>
</$list>
<!-- then add tag -->
<$tiddler tiddler={{exmp65/state}}>
<$fieldmangler>
<$action-sendmessage $message="tm-add-tag" $param="exmp65"/>
</$fieldmangler>
</$list>
</$tiddler>
\end
;How swith a tag among a set of tiddlers? Only one tiddler can have the tag at a time!
: The solution is to use `select` widget and an action macro
The below example demonstrate how to switch a tag among set of tiddlers. The code has two parts
# select widget to choose one tiddler among set of tiddlers
# action macro to set tag to the selected tiddler and remove it from previous tiddler
Here for this example, tag `exmp65` between three tiddlers is switched. Only one tiddler has the tag at a time. The action macro called `applyTag`.
<$macrocall $name="wikitext-example-without-html"
src="""<$select
tooltip="select a tiddler"
tiddler="exmp65/state"
field="text"
actions=<<applyTag>>
>
<$list filter="[search:title[exmp65/data]]" variable="tid">