[tw5] Re: Help with the helpbutton macro..

2021-02-23 Thread Ste
Just a minor thing for anyone else, Eric's awsome solution is missing a > 
after <$tiddler tiddler=<> so it should be <$tiddler 
tiddler=<>> and works like a charm!  Thanks once again.

On Tuesday, 23 February 2021 at 16:37:34 UTC Ste wrote:

> Thank you Eric,
> Much appreciated.  I had thought it might be the words 'current tiddler'  
> but had no clue what to do about it!
>
> On Tuesday, 23 February 2021 at 14:23:23 UTC Eric Shulman wrote:
>
>> On Tuesday, February 23, 2021 at 3:39:31 AM UTC-8 Ste wrote:
>>
>>> \define HelpButton(label, ButtonText:?)
>>> ^^(<$button popup="""$:/temp/popup/$(currentTiddler)$/$label$""" 
>>> class='tc-btn-invisible tc-tiddlylink'>$ButtonText$)<$reveal 
>>> type='popup' state="""$:/temp/popup/$(currentTiddler)$/$label$""">>> class='tc-drop-down' 
>>> style='width:1500px;max-width:75vw;white-space:pre-wrap;padding:10px;text-align:left;font-size:1.5em;border-radus:0.5em;'><$transclude
>>>  
>>> field="""$label$"""/>^^
>>> \end
>>>
>> Now, I have a tabs list:
>>>
>> <>
>>>
>> ...the help button shows when in the tabbed list but works perfectly in 
>>> the original tiddler.
>>>
>>
>> The problem arises because popup's "state" tiddler (
>> $:/temp/popup/$(currentTiddler)$/$label$) depends on the value of 
>> $(currentTiddler)$.
>>
>> In the "original" tiddler, this value is the title of that tiddler.  
>> However, when shown in a tab, the value is the title of the tiddler 
>> containing the entire tab set, rather than the title of the tab content 
>> tiddler itself.
>>
>> As explained in https://tiddlywiki.com/#tabs%20Macro:
>> *The currentTiddler variable is not affected by the tabs macro. This can 
>> put you in trouble if the list of tabs includes tiddlers that depend on the 
>> value of the currentTiddler,*
>>
>> One way to account for this is to wrap your macro within a $tiddler 
>> widget, like this:
>> <$tiddler tiddler=<><>
>>
>> What this does:
>> * when the content is shown in the "original" tiddler, the value of 
>> <> is undefined, so the $tiddler widget has no effect
>> * when the content is shown in a tab, the value of <> is 
>> set to the same as the <>
>>
>> Note that, to make this usage a bit cleaner, you could re-write your code 
>> as follows:
>> \define HelpButton(label, ButtonText:?) <$tiddler 
>> tiddler=<><>
>> \define HelpButton_inner(label, ButtonText:?)
>> ^^(<$button popup="""$:/temp/popup/$(currentTiddler)$/$label$""" 
>> class='tc-btn-invisible tc-tiddlylink'>$ButtonText$)<$reveal 
>> type='popup' state="""$:/temp/popup/$(currentTiddler)$/$label$""">> class='tc-drop-down' 
>> style='width:1500px;max-width:75vw;white-space:pre-wrap;padding:10px;text-align:left;font-size:1.5em;border-radus:0.5em;'><$transclude
>>  
>> field="""$label$"""/>^^
>> \end
>>
>> The first macro adds the $tiddler wrapper and then invokes the actual 
>> HelpButton code (now renamed HelpButton_inner)
>>
>> enjoy,
>> -e
>>
>>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/74b93e02-2692-4503-8440-d1dd11331589n%40googlegroups.com.


[tw5] Re: Help with the helpbutton macro..

2021-02-23 Thread Ste
Thank you Eric,
Much appreciated.  I had thought it might be the words 'current tiddler'  
but had no clue what to do about it!

On Tuesday, 23 February 2021 at 14:23:23 UTC Eric Shulman wrote:

> On Tuesday, February 23, 2021 at 3:39:31 AM UTC-8 Ste wrote:
>
>> \define HelpButton(label, ButtonText:?)
>> ^^(<$button popup="""$:/temp/popup/$(currentTiddler)$/$label$""" 
>> class='tc-btn-invisible tc-tiddlylink'>$ButtonText$)<$reveal 
>> type='popup' state="""$:/temp/popup/$(currentTiddler)$/$label$""">> class='tc-drop-down' 
>> style='width:1500px;max-width:75vw;white-space:pre-wrap;padding:10px;text-align:left;font-size:1.5em;border-radus:0.5em;'><$transclude
>>  
>> field="""$label$"""/>^^
>> \end
>>
> Now, I have a tabs list:
>>
> <>
>>
> ...the help button shows when in the tabbed list but works perfectly in 
>> the original tiddler.
>>
>
> The problem arises because popup's "state" tiddler (
> $:/temp/popup/$(currentTiddler)$/$label$) depends on the value of 
> $(currentTiddler)$.
>
> In the "original" tiddler, this value is the title of that tiddler.  
> However, when shown in a tab, the value is the title of the tiddler 
> containing the entire tab set, rather than the title of the tab content 
> tiddler itself.
>
> As explained in https://tiddlywiki.com/#tabs%20Macro:
> *The currentTiddler variable is not affected by the tabs macro. This can 
> put you in trouble if the list of tabs includes tiddlers that depend on the 
> value of the currentTiddler,*
>
> One way to account for this is to wrap your macro within a $tiddler 
> widget, like this:
> <$tiddler tiddler=<><>
>
> What this does:
> * when the content is shown in the "original" tiddler, the value of 
> <> is undefined, so the $tiddler widget has no effect
> * when the content is shown in a tab, the value of <> is 
> set to the same as the <>
>
> Note that, to make this usage a bit cleaner, you could re-write your code 
> as follows:
> \define HelpButton(label, ButtonText:?) <$tiddler 
> tiddler=<><>
> \define HelpButton_inner(label, ButtonText:?)
> ^^(<$button popup="""$:/temp/popup/$(currentTiddler)$/$label$""" 
> class='tc-btn-invisible tc-tiddlylink'>$ButtonText$)<$reveal 
> type='popup' state="""$:/temp/popup/$(currentTiddler)$/$label$"""> class='tc-drop-down' 
> style='width:1500px;max-width:75vw;white-space:pre-wrap;padding:10px;text-align:left;font-size:1.5em;border-radus:0.5em;'><$transclude
>  
> field="""$label$"""/>^^
> \end
>
> The first macro adds the $tiddler wrapper and then invokes the actual 
> HelpButton code (now renamed HelpButton_inner)
>
> enjoy,
> -e
>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/92471a03-d519-485f-a8f0-167b06f3320an%40googlegroups.com.


[tw5] Re: Help with the helpbutton macro..

2021-02-23 Thread Eric Shulman
On Tuesday, February 23, 2021 at 3:39:31 AM UTC-8 Ste wrote:

> \define HelpButton(label, ButtonText:?)
> ^^(<$button popup="""$:/temp/popup/$(currentTiddler)$/$label$""" 
> class='tc-btn-invisible tc-tiddlylink'>$ButtonText$)<$reveal 
> type='popup' state="""$:/temp/popup/$(currentTiddler)$/$label$"""> class='tc-drop-down' 
> style='width:1500px;max-width:75vw;white-space:pre-wrap;padding:10px;text-align:left;font-size:1.5em;border-radus:0.5em;'><$transclude
>  
> field="""$label$"""/>^^
> \end
>
Now, I have a tabs list:
>
<>
> ...the help button shows when in the tabbed list but works perfectly in 
> the original tiddler.
>

The problem arises because popup's "state" tiddler (
$:/temp/popup/$(currentTiddler)$/$label$) depends on the value of 
$(currentTiddler)$.

In the "original" tiddler, this value is the title of that tiddler.  
However, when shown in a tab, the value is the title of the tiddler 
containing the entire tab set, rather than the title of the tab content 
tiddler itself.

As explained in https://tiddlywiki.com/#tabs%20Macro:
*The currentTiddler variable is not affected by the tabs macro. This can 
put you in trouble if the list of tabs includes tiddlers that depend on the 
value of the currentTiddler,*

One way to account for this is to wrap your macro within a $tiddler widget, 
like this:
<$tiddler tiddler=<><>

What this does:
* when the content is shown in the "original" tiddler, the value of 
<> is undefined, so the $tiddler widget has no effect
* when the content is shown in a tab, the value of <> is 
set to the same as the <>

Note that, to make this usage a bit cleaner, you could re-write your code 
as follows:
\define HelpButton(label, ButtonText:?) <$tiddler 
tiddler=<><>
\define HelpButton_inner(label, ButtonText:?)
^^(<$button popup="""$:/temp/popup/$(currentTiddler)$/$label$""" 
class='tc-btn-invisible tc-tiddlylink'>$ButtonText$)<$reveal 
type='popup' state="""$:/temp/popup/$(currentTiddler)$/$label$"""><$transclude
 
field="""$label$"""/>^^
\end

The first macro adds the $tiddler wrapper and then invokes the actual 
HelpButton code (now renamed HelpButton_inner)

enjoy,
-e

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/00331954-0dea-490d-9e4a-af90e396495dn%40googlegroups.com.