how to change multi-state button from code
MorgoZ
Posts: 116
Hello,
a newbie question:
it is the first time that i'm using multi-state buttons, and i need to change its states from code. I know how to do it with a bi-state button (on[dvTp, nButton] or [dvTp, nButton] = 1), but how do you set a state of a multi-state button from code?
Thanks!
a newbie question:
it is the first time that i'm using multi-state buttons, and i need to change its states from code. I know how to do it with a bi-state button (on[dvTp, nButton] or [dvTp, nButton] = 1), but how do you set a state of a multi-state button from code?
Thanks!
0
Comments
To have a button that has multiple "States" so-to-speak, you might make a normal button (just on and off states) but is also a multi-state bar graph. Make the bar graph part "Display Only" Then make the range from low to high however many states you want. (ex: 10 states = low-1 high-10) Load in your graphics or whatnot for each state of the level. To effect change of state on the touch panel you just send the level. The graphic will change just fine. and, as a button, you just program the button event and don't have to turn the button feedback on or off, just end the level.
Thank you very much!
I'd also say that it's probably a lot easier to migrate code from G4 panels to G5s. Not all commands that work on the G4 work on the G5. But, levels are still sticking around.
Paul
I'm trying Eric's answer, but since in my bargraph i still have "on" and "off" states, how do i set the graphics for all the states?
I want to implement a 4 state button (in this case, bargraph). It is simple, i just need a button that chages its color at each state (red, yellow, green and grey... some kind of semaphore), i had set the button to "bargraph" type and the "level function" to "display only", but now i don't know how to set the state's colors.
Any advice?
Thanks!
I have attached a TP4 example of a button with 4 states (Apple, Orange, Peach, Pineapple) The button number is 101, the level number is 5, the text address is 20.
here is some code to illustrate how you'd send feedback and handle the button push. You do not need to turn the button ON or OFF, you just send the level instead. Level=state.
In this example, we have an imaginary device that is returning a string to indicate its current state (4 states) When we get the string to tell us what state it is in we populate a variable called MyState and then update the feedback to the button. the function sends the appropriate level.
It was only that i was using bargraph and not multi-state bargraph.
Thanks also for the complete example, Eric.
Salutes!!