Is it possible to change the current state of a button (On/Off) based on a system time _Now#xx event in 6.0?
I have an application where I need to use a button to change the state of a boolean expression variable on a graphic, and that boolean must then remain true until the system time is a certain value. At that time, the boolean must revert back to false. I have attempted to use buttons and expression variables to do this however I am unable to change the state of the button back to Off when the time event happens. Hence, the variable will only go false for the duration of the timed event (1s) and then go true again. Is there a way to do this?
Answers
Program it in a controller !!! Thats what PLC's are for.
Graphics are unreliable for performing control logic. What happens when someone changes the page ? Who is going to look after this code when you quit ? PG2 expressions are absolutely not designed for this. Calculation aspects can sometimes work as a substitute but will never be as reliable as your PLC.
Graphics are unreliable for performing control logic. What happens when someone changes the page ? Who is going to look after this code when you quit ? PG2 expressions are absolutely not designed for this. Calculation aspects can sometimes work as a substitute but will never be as reliable as your PLC.
I fully agree with the previous answer but was just curious if it would work :-)
Add a Property Writer to your button, or better to some graphics that is always visible on the screen (in such case you may need to define your expression variable as shared).
Configure Property Writer Event: OnDemand, Trigger: your system time expression, Target: your boolean expression variable and Value: false.


Add a Property Writer to your button, or better to some graphics that is always visible on the screen (in such case you may need to define your expression variable as shared).
Configure Property Writer Event: OnDemand, Trigger: your system time expression, Target: your boolean expression variable and Value: false.


Another solution:
1. create a expression variable "clickTime", type DateTime, no expression
2. create a expression variable "trigger", type Boolean, expression: _Now < clickTime
3. add a Push Button
4. Value: _Now + 10.
5. Target: clickTime
6. BackGroundBrush: if trigger then Red else Gray
If you click on the Button the Button turn to red and back to gray after 10 seconds.
1. create a expression variable "clickTime", type DateTime, no expression
2. create a expression variable "trigger", type Boolean, expression: _Now < clickTime
3. add a Push Button
4. Value: _Now + 10.
5. Target: clickTime
6. BackGroundBrush: if trigger then Red else Gray
If you click on the Button the Button turn to red and back to gray after 10 seconds.
Add new comment