On Sunday, May 31, 2015 at 5:27:48 PM UTC-4, Shango wrote:
>
>
>
> On Sunday, May 31, 2015 at 1:10:36 PM UTC-4, Jed Carty wrote:
>>
>> For this the easiest way is to use the action-sendmessage widget and the
>> tm-add-tag message and the fieldmangler widget. Here is an example:
>>
>> <$fieldmangler tiddler=<<tiddler.title>>>
>> <$button>label
>> <$action-sendmessage $message="tm-new-tiddler" $param="ChatsTemplate"
>> tags=<<currentTiddler>> title=<<tiddler.title>>/>
>> <$action-sendmessage $message="tm-add-tag" $param=someothertag/>
>> New Chat
>> </$button>
>> </$fieldmangler>
>>
>> To add more tags just add more tm-add-tag messages.
>
>
> It is adding the tags to the tiddler that has the button, not the newly
> created tiddler. Since the new tiddler's title is created dynamically, I
> don't know the name of the new tiddler until it is created, so I don't know
> how to reference it with the fieldmangler widget.
>
>
Ok I think I got it working. What this does is (when the button is
clicked) it creates a new tiddler with a tag of the creating tiddler's
title, in addition, another tag ("chats"). Also the newly created tiddler
is named with the creating tiddler's title with "-chat" added as a suffix.
I had expected that if more than one tiddler is created from the same
tiddler, that it would add an incremental # at the end to create a unique
tiddler, but it does not. If a tiddler is created with the button and then
it is pressed again, then the previously created tiddler is re-opened in
edit mode. I'm trying to see how to get it to increment so that it will
create and additional tiddler if one already exists.
\define chatTags() [[$(currentTiddler)$]] chats
\define chatTiddler() $(currentTiddler)$-chat
<$button>
<$action-sendmessage $message="tm-new-tiddler" $param="ChatsTemplate" tags
=<<chatTags>> title=<<chatTiddler>>/>
New chat
</$button>
>
--
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 post to this group, send email to [email protected].
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/c069ef70-a40b-466c-bcaa-321dfa50f305%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.