HI
On Wednesday, 11 November 2015 07:57:03 UTC+2, Tobias Beer wrote:
>
> Hi Matabele,
>
> So, the problem lies in having two widgets needing to know of the same
> unique title to use, one being action-sendmessage and the other
> action-setfield in your given example.
>
Yes.
I'm beginning to ask myself if — in these circumstances — a given widget
> could not be given the possibility to set a variable for its parent scope,
> so that we would do:
>
> <$button>
> <$action-sendmessage $message="tm-new-tiddler" title="My New Tiddler"/>
> <$action-setfield field1="one" field2="two" .../>
> Create New Tiddler
> </$button>
>
> Notice how now *action-setfield* does not specify any tiddler title. That
> is because *action-sendmessage*, specifically the *tm-new-tiddler*
> message would actually set the *currentTiddler* variable for the scope of
> its parent, the *button *widget, upon execution and thus avail the new
> title to any subsequent action-widgets.
>
Passing values (from an action widget) for variables to the parent scope is
a good idea -- setting the value of the <<currentTiddler>> is not, as this
changes the target tiddler for simple references (like {{!!title}} -- used
for 'New Here' buttons, for example.)
The current tiddler can be set by enclosing the whole button within a
$tiddler widget, but:
-- I found this approach problematic when writing application buttons
-- the title of the new tiddler isn't known before the new tiddler gets
created
I adopted the approach of passing the value through a parameter to the
widget message. This approach becomes complicated when several widget
messages are involved (as for my legacy widgets.)
The introduction of a new <<targetTiddler>> variable within the enclosing
$button widget would be a tidier approach:
-- the value of this variable could then be set by any action widget (when
specified)
-- and could then be used by any following action widgets by default.
This would also address the annoying necessity of having to re-specify the
target when using a stack of action widgets with the same target.
regards
>
>> The $tags attribute of the widget allows for a subfilter to be applied to
>> the list of tags copied from the template -- allowing tags to be
>> added/removed/replaced etc.
>>
>
> Unless you already have, perhaps a few demo examples would be great to
> illustrate your widget's workings like these. At the moment, those links in
> your wiki appear to either be broken or the target contents removed.
>
> Any other desired functionality can be easily added via additional
>> attributes -- something that would be more difficult with the
>> 'tm-new-tiddler' method.
>>
>> In general, I also find the action widget method more straightforward and
>> more easily understood than methods based around widget messaging.
>>
>
> It's not the first time that I have read that statement, although I
> wouldn't know what it actually means... as I have not studied both enough
> to understand the limitations to how the core is indeed processing things
> action- or message-wise.
>
> Best wishes,
>
> — tb
>
--
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/59392481-d57b-4ae4-8690-abf7a57d6789%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.