How can I use the pushbutton action as a variable in an expression?
exameple: I want to make an expression like: If H1 is larger than 10 and PushButton1 is pressed then ....
So, can I use the action of pressing the PushButton1 in an expression? How?
Voted best answer
You may create a variable in a General Properties aspect for the button. However, if you need the variable go False as soon as the button is released, instead of putting that variable to the Target parameter of the pushbutton, you can add an Item Hosted Input Item (Value Writer) to the pushbutton and put this variable to both OnDownTarget and OnUpTarget parameters of the value writer, setting OnDownValue to True and OnUpValue to False. Now you can use this variable meaning "pushbutton is pressed" in any expression with any additional conditions, like H1>10.
The standar PushButton has an out terminal called depressed which does not work because it is fixed to False. However if you override that elemen in graphics structure and edit it you can see another expression variable called "StatePushed" which is not exposed as out terminal. Now, if you set that variable to "Exposed as Out Terminal" you may use this state like PushButton1.StatePushed in any expression together with any other condition.