Mario,

Thanks for demonstrating the use of Unicode characters on this. Unlike svg 
icons its easy to color them and add them to the view toolbar.

Eg in a tiddler tagged view toolbar
\whitespace trim
\define toggle-urgent()
<$action-listops $tiddler={{!!title}} $field="tags" 
$subfilter="+[toggle[urgent]]" />
\end
<$button actions=<<toggle-urgent>> class="tc-btn-invisible"><$list 
filter="[all[current]tag[urgent]then[&#9733;]else[&#9734;]]"><span 
style="color: red;"><<currentTiddler>></span></$list></$button>

Tones
On Monday, 31 May 2021 at 20:40:49 UTC+10 PMario wrote:

> On Monday, May 31, 2021 at 11:49:48 AM UTC+2 PMario wrote:
>
> If you search for "toggle" at tiddlywiki.com you'll find: 
> https://tiddlywiki.com/#toggle%20Operator%20(Examples):%5B%5Btoggle%20Operator%20(Examples)%5D%5D%20%5B%5Btoggle%20Operator%5D%5D
>
> The examples already contain the "action-listops" ... 
>
> \define toggle-urgent()
>> <$action-listops $tiddler={{!!title}} $field="tags" 
>> $subfilter="+[toggle[urgent]]" />
>> \end
>>
>
> I did modify the $fields="tags" and 
> changed the $subfilter="+[toggle[urgent]]" .. so it toggles between 1 
> value 
>
> There's the action-listops docs 
> <https://tiddlywiki.com/#ActionListopsWidget>. It has a lot of 
> possibilities, but also a lot of examples to play with.
>  
>
>> <$button actions=<<toggle-urgent>> >
>>
>
> This is a relatively common usage of the button-widget 
> <https://tiddlywiki.com/#ButtonWidget>. Using actions=<<macro-name>> will 
> clean up the code, if you need to call more than 1 action. ... It is "best 
> practice". 
>  
>
>> <$list 
>> filter="[all[current]tag[urgent]then[&#9733;]else[&#9734;]]"><<currentTiddler>></$list>
>>
>
> all[current] ... will return the currentTiddler variable. 
> tag[urgent] ... tests if the "urgent" tag is set
> then[&#9733;] ... will set the currentTiddler variable of the list-body 
> to the "filled star" character
> else[&#9734;] ... will set the currentTiddler variable of the list-body 
> to the "empty star" character
>
> <<currentTiddler>> ... will show the star, depending on tag - then / else 
> ... see: currentTiddler 
> <https://tiddlywiki.com/#Current%20Tiddler:%5B%5BCurrent%20Tiddler%5D%5D%20%5B%5BcurrentTiddler%20Variable%5D%5D%20%5B%5BcurrentTiddler%20Variable%20(Examples)%5D%5D>
>  
> variable
>   
>
>> </$button>
>>
>> You can call it with {{|| my-toggle-template}}
>>
>
> Uses the transcluded tiddler as a template. see more info here 
> <https://tiddlywiki.com/#Transclusion:Transclusion%20%5B%5BTransclusion%20with%20Templates%5D%5D%20TemplateTiddlers>.
>  
>
>  
>
>> If you want to hide the button use: <$button *class="tw-btn-invisible"* 
>> actions=<<toggle-urgent>> > ... you will only get the star.
>>
>
> Just test it ;)
>
> hope that helps
> -mario
>  
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/f2dd99ab-37d6-4ea3-93bd-7f16146d844bn%40googlegroups.com.

Reply via email to