08-15-2008 04:03 PM
I am writing a program that has over 120 buttons. 60 of them are run buttons and 60 of them are stop buttons. Each pair of buttons controls a microcontroller with a specific address.
When I press a run button, I run the same subVI for all of them, with the only difference being the address
My question is, can I make a singe user event that detects whenever a run button is pushed that will also tell me which run button was actually pushed (to allow me to have the correct address for the microcontroller)
I DON'T want to make 120 different user events
I want to make 2
one for all the run buttons
one for all the stop buttons
any help would be nice
08-15-2008 04:20 PM - edited 08-15-2008 04:22 PM
Make an array of 60 run buttons and 60 stop buttons, then find the changed element by comparing the oldval and newval event terminals.
Here's a recent discussion using 2D arrays. Most likely you want to arrange your buttons in 2D for a better FP design.
(How about a single 2D array with booleans and use the buttons for both on and off?)
08-15-2008 04:20 PM - edited 08-15-2008 04:21 PM
I would use a Dynamic Event that fired on the Value Change of any one of a group of controls. You could create two Dynamic events, and wire all the Run control references to one, and all the Stop control references to another. Here's a screenshot...when the event fires, you can get the control label to figure out which button was pressed:
Hope this helps,
-D
08-15-2008 04:23 PM
08-15-2008 04:50 PM
08-20-2008 10:01 AM
How about two buttons and an address control? Set the address to the device to be turned on or off then press the single On or Off button. You could use 120 indicators if you need to show the status of all the devices.
Lynn