On Monday, October 12, 2020 at 12:17:40 AM UTC-7, Shareda wrote:
>
> TW Tones, here is an example code from UI preferences:
> <$reveal type="match" state="$:/hb/Scrollable" text="yes">
>   <$edit-text tiddler="$:/hb/CiteDivHeight" 
> default="600" size="1" rows="1" autoHeight="no"tag=input/> <$range 
> tiddler="$:/hb/CiteDivHeight" min="300" max="999" 
> default="600" increment="10" tooltip='300-999px'/>
> </$reveal>
> Instead of this I can use List like <$list 
> filter='[all[$:/hb/Scrollable]get[text]prefix[yes]]'> 
> and so on.
>

Just a few notes about the example $list you posted:

The all[...] operator takes one or more *keywords* (current, missing, 
orphans, shadows, tags, tiddlers) as a parameter, not a tiddler title.
To specify a literal tiddler title, use title[TiddlerName] or just 
[TiddlerName], like this:
<$list filter='[[$:/hb/Scrollable]get[text]prefix[yes]]'>

In place of the combination of [TiddlerName]get[text], you could write 
{TiddlerName!!text}, like this:
<$list filter='[{$:/hb/Scrollable!!text}prefix[yes]]'>

By default, the $list widget sets "currentTiddler" within the body of the 
<$list>...</$list>.
Thus, in your example code, the value of <<currentTiddler>> within the 
$list body will be "yes".

To leave the value of currentTiddler unchanged, you must specify an 
alternative variable name, like this:
<$list filter='[[$:/hb/Scrollable]get[text]prefix[yes]]' 
variable="something">

As an alternative, you could also preserve the value currentTiddler by 
adding "then<currentTiddler>" at the end of your test, like this:
<$list filter='[[$:/hb/Scrollable]get[text]prefix[yes]then<currentTiddler>
]'>

Of course, if you don't use the result within the body of the $filter (as 
in your example, which explicitly specifies tiddler="$:/hb/CiteDivHeight"), 
then you can omit the variable="..." syntax entirely.
Even so, it's a good convention to use a variable whenever the $list is 
just being used as a conditional test. I like to use a name that describes 
the purpose of the test, like this:
<$list filter='[[$:/hb/Scrollable]get[text]prefix[yes]]' 
variable="if_scrollable_flag_is_set">

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/4a0602b0-5cfe-47c3-9062-0fd1ec556ef3o%40googlegroups.com.

Reply via email to