[TW5] Adding a button to the view toolbar

301 views
Skip to first unread message

Linus Johnsson

unread,
Jun 17, 2015, 9:15:59 AM6/17/15
to tiddl...@googlegroups.com
Dear all,

I have tried adding a simple button to the view toolbar. It's supposed to create a tiddler tagged with the current tiddler and "§todo".

Here is the code for the button tiddler ($:/gpqw/buttons/NewToDoHere):

\define newToDoHereButtonTags()
[[$(currentTiddlerTag)$]] $(toDoTags)$
\end

\define newHereButton()
<$button tooltip={{$:/gpqw/buttons/NewToDoHere/Hint}} aria-label={{$:/gpqw/buttons/NewToDoHere/Caption}} class=<<tv-config-toolbar-class>>>
<$action-sendmessage $message="tm-new-tiddler" title="NewToDo" tags=<<newToDoHereButtonTags>> />
<$list filter="[<tv-config-toolbar-icons>prefix[yes]]">
{{$:/core/images/done-button}}
</$list>
<$list filter="[<tv-config-toolbar-text>prefix[yes]]">
<span class="tc-btn-text"><$text text={{$:/gpqw/buttons/NewToDoHere/Caption}}/></span>
</$list>
</$button>
\end

<$set name="toDoTags" value="§todo">
<$set name="currentTiddlerTag" value=<<currentTiddler>>>
<<newToDoHereButton>>
</$set></$set>

I've set the "caption" field to "{{$:/core/images/done-button}} {{$:/gpqw/buttons/NewToDoHere/Caption}}" and "description" to {{$:/gpqw/buttons/NewToDoHere/Hint}} and added some text to the latter two tiddlers. I've tagged the button tiddler ($:/gpqw/buttons/NewToDoHere) with "$:/tags/ViewToolbar". I've added a tiddler named "$:/config/ViewToolbarButtons/Visibility/$:/gpqw/buttons/NewToDoHere" and set its text to "show" ("reveal" is suggested in the documentation but this seems incorrect). I've also added the tiddler name to the list in $:/tags/ViewToolbar.

Although the button shows up as expected in the control panel, it does not appear in the toolbar. I think I've followed the instructions to the best of my ability. Could anyone help me pinpoint the problem?


Best regards,
Linus

Ton Gerner

unread,
Jun 17, 2015, 10:37:48 AM6/17/15
to tiddl...@googlegroups.com
Hi Linus,

You are almost there.

Change in the second macro

\define newHereButton()

to

\define newToDoHereButton()

and it works.

Cheers,

Ton

Linus Johnsson

unread,
Jun 17, 2015, 11:12:42 AM6/17/15
to tiddl...@googlegroups.com
Aargh, I can't believe I didn't see that. Thanks a lot! Also, my apologies for bothering the community with typos ...

Linus

--
You received this message because you are subscribed to a topic in the Google Groups "TiddlyWiki" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tiddlywiki/esMYRtb9uLA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/14dc3ff9-0670-4a4d-ad58-9686898c508d%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages