Setting attributes as values from a <$list> in an <$action-setfield>

87 views
Skip to first unread message

leeand00

unread,
Jan 6, 2016, 3:02:53 PM1/6/16
to TiddlyWiki
In the following code, is there any way to get the title to show up in the action-setfield attributes?

See example below:

<$button>
<$list filter="[ [] ]">
<$action-setfield text="[[edit|{{!!title}}]]"  tags="[[General Settings]]" caption="{{!!title}}"/>

<$action-navigate/>
</$list>
Make New Tiddlers
</$button>

Also, is there any place where the rules for this sort of thing are defined?

Thank you,
   Andrew J. Leer

Tobias Beer

unread,
Jan 6, 2016, 4:59:41 PM1/6/16
to TiddlyWiki
Hi Andrew,
 
In the following code, is there any way to get the title to show up in the action-setfield attributes?

While I assume your filter is a placeholder for whatever the real filter is
and the text you wish to generate is a bit awkward,
you need to use a helper macro to construct the text, e.g.:

<$button>
<$list filter="[[]make[max:10]]">
<vars new-text="[[edit|$(currentTiddler)$]]">
<$action-setfield text=<
<new-text>>  tags="[[General Settings]]" caption="{{!!title}}"/>
</$vars>

<$action-navigate/>
</$list>
Make New Tiddlers
</$button>

Notice how I abused the vars widget to actually declare this macro which doesn't need parameters.

Try the above in a new tiddler at:


Instead of using the vars widget you could also do (a more traditional):

define new-text() [[edit|$(currentTiddler)$]]

<$button>
<$list filter="[[]make[max:10]]">
<$action-setfield text=<
<new-text>>  tags="[[General Settings]]" caption="{{!!title}}"/>

<$action-navigate/>
</$list>
Make New Tiddlers
</$button>

Best wishes,

Tobias.

leeand00

unread,
Jan 7, 2016, 9:36:37 AM1/7/16
to TiddlyWiki
Thanks again Tobias!  As usual that did the trick.  You have been essential in speeding up my TW5 usage.

Tobias Beer

unread,
Jan 7, 2016, 10:54:52 AM1/7/16
to TiddlyWiki
Hi leeand00,
 
Thanks again Tobias!  As usual that did the trick. 
You have been essential in speeding up my TW5 usage.

Happy to hear. You're very welcome. :-)

Best wishes,

Tobias.
Reply all
Reply to author
Forward
0 new messages