Ton,

Great proof of concept. I can work with this. I can put in a test to see if 
buttonto's tiddler already has the $:/tags/ViewToolbar tag and hide the 
additional set up actions.

I can see how to build on this. Not sure why I did not envision this 
approach.

I like how the tiddler to create the button also becomes the button. 

I want this to allow actions such create field or have two buttons in a 
toggle, and additional actions etc.. so as you say further thought is 
necessary.

Thank you
Tony

On Friday, January 31, 2020 at 5:27:12 AM UTC+11, Ton Gerner wrote:
>
> Hi Tony,
>
> I was thinking of macros for making buttons.
> In case of a button that calls a tiddler (in many use cases, and in the 
> core the buttons for control panel, tiddler manager and tag manager) it can 
> be done.
>
> As proof of concept I made the following macro:
>
> \define buttonto(tiddler,image,description,caption,tag)
> <$button to="$tiddler$" tooltip="$tooltip$" class=<<tv-config-toolbar-
> class>>>
> <$action-setfield $field="caption" $value="{{$image$}} $caption$"/>
> <$action-setfield $field="description" $value="$description$"/>
> <$action-setfield $field="tags" $value="$tag$"/>
> <$list filter="[<tv-config-toolbar-icons>match[yes]]">
> {{$image$}}
> </$list>
> <$list filter="[<tv-config-toolbar-text>match[yes]]">
> <$text text="$caption$"/>
> </$list>
> </$button>
> \end
>
> To 'recreate' the Control panel button, create a tiddler containing:
>
> <<buttonto $:/ControlPanel $:/core/images/options-button "Open control 
> panel" "control panel" "$:/tags/ViewToolbar">>
>
> When clicking the button (cogwheel in this created tiddler)
>
>    1. the tiddler will be tagged with $:/tags/ViewToolbar
>    2. the caption and description fields will be created
>    3. a control panel button will be added to the tiddler controls
>    4. in Control panel > Appearance > Toolbars > View toolbar an extra 
>    control panel button with checkbox will be added
>
> With given macro tiddler manager and tag manager can be `recreated` as 
> well.
> Many user buttons that call a tiddler with certain functionality in it can 
> be created with this macro.
>
> Notes for this proof of concept
>
>    1. You need to click the button in the button tiddler once to add tag, 
>    caption and description field; thereafter th real button will be available
>    2. After that the 3 action-setfield widgets will be activated with 
>    each button click while there is no need for it anymore
>
>
> So it needs some polishing but in principle it works.
>
> Cheers,
>
> Ton
>

-- 
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/24ba0043-27e6-4322-b50b-78cc361483fd%40googlegroups.com.

Reply via email to