[TW5] Button to append a short phrase to the text of the current tiddler?

115 views
Skip to first unread message

Matthew Petty

unread,
Mar 20, 2016, 8:58:36 AM3/20/16
to TiddlyWiki
I want to create a button to append a short phrase to the text of the current tiddler. I've been playing with the example below, but how to I make it refer to the current tiddler, and not a specific one?



\define thisAction()
<$action-setfield $tiddler=HelloThere text="""$(HelloThereText)$$(LearningText)$"""/>
\end

<$set name=HelloThereText value={{HelloThere}}>
<$set name=LearningText value={{Learning}}>
<$button>Test
<<thisAction>>
</$button>
</
$set>
</$set>


BJ

unread,
Mar 20, 2016, 10:17:20 AM3/20/16
to TiddlyWiki
Hi Matthew,
just remove the '$tiddler=.." and it will default to the value of <<currentTiddler>>

all the best

BJ

Dave

unread,
Mar 21, 2016, 5:59:00 PM3/21/16
to tiddl...@googlegroups.com
That code above (with "$tiddler=" removed) actually *replaces* the button code. 

I tried a simplified version like this to use the current text field to append text to

\define thisAction()
<$action-setfield  text="{{!!text}}
hi there"
>
\end

<$button>Test
<<thisAction>>
</$button>


but I got an error

Recursive transclusion error in transclude widget hi there hi there


This would be useful if you could get past this error.

Mat

unread,
Mar 21, 2016, 6:10:30 PM3/21/16
to TiddlyWiki
I think what's happening is that the {{!!text}} tries to transclude the text field from the current tiddler... which is defining the tiddler, where it is called.. recursion.

You could separate out the macro into another tiddlerhtan the one it is called from. If that's not enough, then maybe introduce a parameter that you call the macro with and which is intersted as the tiddler title into the transclusion.

<:-)
Reply all
Reply to author
Forward
0 new messages