Using the select widget actions

62 views
Skip to first unread message

TonyM

unread,
Apr 5, 2020, 9:31:01 AM4/5/20
to tiddl...@googlegroups.com
Folks,

Any guidance on why this may not work would be appreciated.
  • The below macros uses a select widget to set a selected-input field
  • I am then using the actions parameter on the select widget to invoke set-input-actions
  • However the intended actions to set the input field never works
\define set-input-actions()
<$list filter="[{!!selected-input}match[allobjects]]">
   <$action-setfield $field="input" $value="[!is[system]object-type{!!selected-object}]"/>
</$list>
<$list filter="[{!!selected-input}match[objects]]">
   <$action-setfield $field="input" $value={{!!instances-list}}/>
</$list>
<$list filter="[{!!selected-input}match[lists]]">
   <$action-setfield $field="input" $value="{{!!selected-lists}}"/>
</$list>
<$list filter="[{!!selected-input}match[filter]]">
   <$action-setfield $field="input" $value="{{!!selected-filter}}"/>
</$list>
\end
\define select-input()
<$select field=selected-input actions=<<set-input-actions>> >
<option value="allobjects">All Instances of Object</option>
<option value="objects">Selected Objects</option>
<option value="lists" >Selected list(s)</option>
<option value="filter" >Input Filter</option>
</$select>
\end
<<select-input>>

I have tested the conditions in the actions but they are not working "as actions"
  • Could it be that the actions are called before the selected-input field is set?
    • But then the previous value would be used and it is not!
    • actionsA string containing ActionWidgets to be triggered when the key combination is detected
  • Later I will need to trigger these actions again with changes other than selected-input as well.
Is there a better, or even working method?

Any help would be appreciated.

Regards
Tony

Saq Imtiaz

unread,
Apr 5, 2020, 10:34:34 AM4/5/20
to TiddlyWiki
Is the output of your filters what you want currentTiddler set to? 

If not, use a different variable in the list widget or specify the tiddler for the actions.

Eric Shulman

unread,
Apr 5, 2020, 10:39:42 AM4/5/20
to TiddlyWiki
On Sunday, April 5, 2020 at 6:31:01 AM UTC-7, TonyM wrote:
Any guidance on why this may not work would be appreciated.r works
\define set-input-actions()
<$list filter="[{!!selected-input}match[allobjects]]">
   <$action-setfield $field="input" $value="[!is[system]object-type{!!selected-object}]"/>
</$list>
<$list filter="[{!!selected-input}match[objects]]">
   <$action-setfield $field="input" $value={{!!instances-list}}/>
</$list>
<$list filter="[{!!selected-input}match[lists]]">
   <$action-setfield $field="input" $value="{{!!selected-lists}}"/>
</$list>
<$list filter="[{!!selected-input}match[filter]]">
   <$action-setfield $field="input" $value="{{!!selected-filter}}"/>
</$list>
\end
I have tested the conditions in the actions but they are not working "as actions"

When you read the answer, I think you'll go "D'oh!":

The $list widgets in set-input-actions() are changing the value of currentTiddler.  As a result, the $action-setfield is creating new tiddlers named with the matched value!

Adding variable="null" to each $list widget fixes the problem.

enjoy,
-e

TonyM

unread,
Apr 5, 2020, 5:38:20 PM4/5/20
to TiddlyWiki
Eric

Thanks for that. That is a reoccurring blind spot that can be hard given the problem is an absence of something.

I am very gratefulTony

Reply all
Reply to author
Forward
0 new messages