[tw] Re: [TW5] MacroCall Widget & sub-macros
Unfortunately they don't show the contents of the "textMaker" macro. I imagine it would have worked as long as "textMaker" didn't use a transclude widget. Mark On Monday, December 12, 2016 at 3:05:08 AM UTC-8, William RENOU wrote: > > I got it from what was used as 3rd example on > http://tiddlywiki.com/#MacroCallWidget. Looks like there are a few errors > on it. It works now, thanks. > > Le lundi 12 décembre 2016 05:10:48 UTC+1, Mark S. a écrit : >> >> Even though they may sometimes seem to perform as functions, macros just >> support text substitution. Your version would have had a widget inside of a >> widget, which probably won't work, except on the 2nd Tuesday of months with >> full moons. Or something. I don't quite have it right yet. >> >> This code seems to work. Hopefully it will be close to what you need: >> >> \define myDataMacro(var2) <$transclude tiddler="$:/data/dataExample" >> index={{$var2$!!keyfield}} /> >> >> >> <$macrocall $name="myDataMacro" var2={{!!mytarget}} /> >> >> >> >> >> On Sunday, December 11, 2016 at 5:47:47 PM UTC-8, William RENOU wrote: >>> >>> I'm currently trying to link a tiddler's field to a DataTiddler >>> (dictionary tiddler). My (semi) working prototype has a SelectWidget >>> pulling up a list of Tiddlers. When one is selected, its fields are >>> displayed. The title of the current displayed tiddler is stored in a field >>> inside the viewer tiddler. One of these fields is codified (to save time >>> when editing this type of tiddler & to save time in case of field >>> codification changes). This field key values are stored in a Dictionary >>> Data Tiddler. My goal is to display the value of the field instead of its >>> stored key. >>> I use two macros to do so : >>> >>>- To retrieve the key to look for 'in the data tiddler) stored in >>>the target tiddler >>> >>> \define targetKey() <$transclude tiddler={{!!myTarget}} field="keyField" >>> /> >>> >>>- I have a second macro that'll look for the value to be displayed >>>in my Data Tiddler >>> >>> \define myDataMacro(var:0) <$transclude tiddler="$:/data/dataExample" >>> index=$var$/> >>> >>>- I globaly use them using a MacroCallWidget >>> >>> <$macrocall $name="myDataMacro" var=<>/> >>> >>> >>>- My Data Tiddler has currently these test values >>> >>> 0:White1:Green2:Blue3:Orange4:Red5:Yellow >>> >>> >>> My issue is the values aren't displayed. It should display the value >>> associated with the correct key, e.g. : when I try it to select a test >>> tiddler having "1" (without the quotes) as value for the *keyField* field, >>> instead of displaying *Green *it displays its value *1.* >>> Using the MacroCallWidget without specifying the *var *variable >>> displays correctly the default value set in the *myDataMacro. *Using a >>> key instead of the sub-macro displays it's value correctly. >>> >> -- 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 tiddlywiki+unsubscr...@googlegroups.com. To post to this group, send email to tiddlywiki@googlegroups.com. Visit this group at https://groups.google.com/group/tiddlywiki. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/1c27690d-7d0b-4f8a-91df-46fa0faaee8f%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[tw] Re: [TW5] MacroCall Widget & sub-macros
I got it from what was used as 3rd example on http://tiddlywiki.com/#MacroCallWidget. Looks like there are a few errors on it. It works now, thanks. Le lundi 12 décembre 2016 05:10:48 UTC+1, Mark S. a écrit : > > Even though they may sometimes seem to perform as functions, macros just > support text substitution. Your version would have had a widget inside of a > widget, which probably won't work, except on the 2nd Tuesday of months with > full moons. Or something. I don't quite have it right yet. > > This code seems to work. Hopefully it will be close to what you need: > > \define myDataMacro(var2) <$transclude tiddler="$:/data/dataExample" index > ={{$var2$!!keyfield}} /> > > > <$macrocall $name="myDataMacro" var2={{!!mytarget}} /> > > > > > On Sunday, December 11, 2016 at 5:47:47 PM UTC-8, William RENOU wrote: >> >> I'm currently trying to link a tiddler's field to a DataTiddler >> (dictionary tiddler). My (semi) working prototype has a SelectWidget >> pulling up a list of Tiddlers. When one is selected, its fields are >> displayed. The title of the current displayed tiddler is stored in a field >> inside the viewer tiddler. One of these fields is codified (to save time >> when editing this type of tiddler & to save time in case of field >> codification changes). This field key values are stored in a Dictionary >> Data Tiddler. My goal is to display the value of the field instead of its >> stored key. >> I use two macros to do so : >> >>- To retrieve the key to look for 'in the data tiddler) stored in the >>target tiddler >> >> \define targetKey() <$transclude tiddler={{!!myTarget}} field="keyField" >> /> >> >>- I have a second macro that'll look for the value to be displayed in >>my Data Tiddler >> >> \define myDataMacro(var:0) <$transclude tiddler="$:/data/dataExample" >> index=$var$/> >> >>- I globaly use them using a MacroCallWidget >> >> <$macrocall $name="myDataMacro" var=<>/> >> >> >>- My Data Tiddler has currently these test values >> >> 0:White1:Green2:Blue3:Orange4:Red5:Yellow >> >> >> My issue is the values aren't displayed. It should display the value >> associated with the correct key, e.g. : when I try it to select a test >> tiddler having "1" (without the quotes) as value for the *keyField* field, >> instead of displaying *Green *it displays its value *1.* >> Using the MacroCallWidget without specifying the *var *variable displays >> correctly the default value set in the *myDataMacro. *Using a key >> instead of the sub-macro displays it's value correctly. >> > -- 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 tiddlywiki+unsubscr...@googlegroups.com. To post to this group, send email to tiddlywiki@googlegroups.com. Visit this group at https://groups.google.com/group/tiddlywiki. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/72acc0d6-c46d-4c39-abf8-c88198df9573%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[tw] Re: [TW5] MacroCall Widget & sub-macros
Even though they may sometimes seem to perform as functions, macros just support text substitution. Your version would have had a widget inside of a widget, which probably won't work, except on the 2nd Tuesday of months with full moons. Or something. I don't quite have it right yet. This code seems to work. Hopefully it will be close to what you need: \define myDataMacro(var2) <$transclude tiddler="$:/data/dataExample" index ={{$var2$!!keyfield}} /> <$macrocall $name="myDataMacro" var2={{!!mytarget}} /> On Sunday, December 11, 2016 at 5:47:47 PM UTC-8, William RENOU wrote: > > I'm currently trying to link a tiddler's field to a DataTiddler > (dictionary tiddler). My (semi) working prototype has a SelectWidget > pulling up a list of Tiddlers. When one is selected, its fields are > displayed. The title of the current displayed tiddler is stored in a field > inside the viewer tiddler. One of these fields is codified (to save time > when editing this type of tiddler & to save time in case of field > codification changes). This field key values are stored in a Dictionary > Data Tiddler. My goal is to display the value of the field instead of its > stored key. > I use two macros to do so : > >- To retrieve the key to look for 'in the data tiddler) stored in the >target tiddler > > \define targetKey() <$transclude tiddler={{!!myTarget}} field="keyField"/> > >- I have a second macro that'll look for the value to be displayed in >my Data Tiddler > > \define myDataMacro(var:0) <$transclude tiddler="$:/data/dataExample" > index=$var$/> > >- I globaly use them using a MacroCallWidget > > <$macrocall $name="myDataMacro" var=<>/> > > >- My Data Tiddler has currently these test values > > 0:White1:Green2:Blue3:Orange4:Red5:Yellow > > > My issue is the values aren't displayed. It should display the value > associated with the correct key, e.g. : when I try it to select a test > tiddler having "1" (without the quotes) as value for the *keyField* field, > instead of displaying *Green *it displays its value *1.* > Using the MacroCallWidget without specifying the *var *variable displays > correctly the default value set in the *myDataMacro. *Using a key instead > of the sub-macro displays it's value correctly. > -- 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 tiddlywiki+unsubscr...@googlegroups.com. To post to this group, send email to tiddlywiki@googlegroups.com. Visit this group at https://groups.google.com/group/tiddlywiki. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/01ea2864-1f53-49bf-8f32-999f90a48264%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.