Hello,

What I've found so far is:

1) Macros and widgets may look something like javascript functions and 
variables, but they often behave differently
2) You can't use a widget's output inside a widget
3) You can use a macro inside a widget IF it doesn't have a parameter
4) Therefore, you will most often need to use <$set ...> to set a variable 
to be used by a macro that gets fed to your widget

Mark

On Saturday, October 3, 2015 at 10:49:00 AM UTC-7, Antaeus Feldspar wrote:
>
> Or, to express it a different way from the subject line, how can I create 
> a button widget that will:
> a) take the current value of a tiddler field;
> b) use that current value as a parameter to a macro to calculate a new 
> value; and
> c) put that new value back into the tiddler field that was read?
>
> WHAT I TRIED:
>
> I've tried various things; my most recent attempt is this:
>
> <$button set=!!test setTo=<$macrocall $name=".js-macro-link" 
> text={{!!test}}/> >Test button</$button>
>
> However, the parser can't seem to handle the angle brackets of the 
> macrocall widget appearing in the middle of the button widget declaration. 
>  Everything after the "/>" that closes the macrocall widget appears as 
> WikiText following a blank button.
>
> Before that I tried calling the macro through the standard syntax, and 
> discovered that (unless there's some way to do it that I missed) you can't 
> use a macro call as an element attribute.
>
> It occurred to me that since a ButtonWidget can contain multiple 
> ActionWidgets, that might be the solution - except that there's nothing in 
> the documentation guaranteeing an order in which such widgets execute, so 
> assigning the output of a macro to a temporary tiddler and then copying it 
> back to the original field does not seem to be an option.
>
> PLEASE NOTE:
>
> Please note that I am trying to get an answer to the GENERAL question, not 
> "how do I get the same effect as if I was applying this particular macro?" 
>  I am sure that there would be a simple way to apply the effect of THIS 
> macro with template transclusion, but that does not answer my question, 
> because sooner or later I will be using the technique for Javascript macros 
> that do mathematical calculations.
>
> DOCUMENTATION SUGGESTION:
>
> A chart which shows the various forms of data sourcing (plain text, 
> TextReference, macro output, etc.) in columns and then shows in rows what 
> they can and can't be used for (macro parameters, element attributes, etc.) 
> would be useful.
>
>

-- 
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/b9f31e05-bf09-4170-a63e-5e57225f3cc0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to