Folks,
I am wondering if any one can provide some guidance on the modifier variable in a collection of different usage forms. It will also through light on the issues with actions and when values are “evaluated” eg at button render or on click.
- I suspect @EricShulman @pmario amongst others, already understand this deeply enough to answer easily.
I have used the modifier variable to detect keyboard modifier keys such as shift, alt and ctrl including normal a few times with success. Then all of a sudden, I started to find it fragile, basically not working for some reason that is not clear to me.
- I started this Topic to create a Discourse wiki post once I have clarity on this, please help us understand this.
- Somehow conceptually I though the modifier value was “plucked from the air” and the time the button is clicked. But this does not seem to be the case.
Consider the following
- Imagine each list has some action widgets within it.
\define button-actions(content)
<$list filter="[<modifier>match[normal]]" variable=nul>
</$list>
<$list filter="[<modifier>match[ctrl]]" variable=nul>
</$list>
<$list filter="[<modifier>match[alt]]" variable=nul>
</$list>
<$list filter="[<modifier>match[shift]]" variable=nul>
</$list>
\end
Now there are a few ways we can call the button-actions from a button or other trigger, note the buttons are numbered for subsequent reference.
<$button actions=<<button-actions param>> >
button 1
</$button>
<$button actions="""<<button-actions param>>""">
button 2
</$button>
<$button>
<<button-body-actions>>
button 3
</$button>
<$button>
<$list filter="[<modifier>match[normal]]" variable=nul>
</$list>
<$list filter="[<modifier>match[ctrl]]" variable=nul>
</$list>
<$list filter="[<modifier>match[alt]]" variable=nul>
</$list>
<$list filter="[<modifier>match[shift]]" variable=nul>
</$list>
button 4
</$button>
- There is another possibility and that is to embed the modifier conditional list inside the
actions="""<$list..."""
let us call thisbutton 5
Your feedback greatly appreciated.