Example attached! Give your comment or alternative solution!
On Tuesday, July 2, 2019 at 5:27:00 PM UTC+4:30, Mohammad wrote:
>
> I think this may be a solution
>
> \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">
> <option value=<<tid>> > <<tid>> </option>
> </$list>
> </$select>
> """/>
>
>
>
>
> This may be not optimized code but work!
>
>
>
--
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/e9995e5d-fcd5-4d12-9119-08bc126371d3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
switch-tag.json
Description: application/json

