Discussion:
User events for 120 buttons
(too old to reply)
cutekittenkyti
2008-08-15 21:10:05 UTC
Permalink
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 eventsI want to make 2one for all the run buttonsone for all the stop buttons any help would be nice
altenbach
2008-08-15 21:40:19 UTC
Permalink
Make an array of 60 run buttons and 60 stop buttons, then find the changed element&nbsp;by comparing&nbsp;the oldval and newval event terminals.&nbsp;<a href="http://forums.ni.com/ni/board/message?board.id=170&amp;message.id=349306#M349306" target="_blank">Here's</a> a recent discussion using 2D arrays. Most likely you want to arrange your buttons in 2D for a better FP design. &nbsp;&nbsp;(How about a single 2D array with booleans and use the buttons for both on and off?)Message Edited by altenbach on 08-15-2008 02:22 PM
altenbach
2008-08-15 22:10:05 UTC
Permalink
Here's a quick draft on what I had in mind (LabVIEW 8.5.1).&nbsp;&nbsp;&nbsp;&nbsp;


60Buttons1Event.vi:
http://forums.ni.com/ni/attachments/ni/170/349729/1/60Buttons1Event.vi
Darren
2008-08-15 21:40:19 UTC
Permalink
I would use a Dynamic Event that fired on the Value Change of any one of a group of controls.&nbsp; You could create two Dynamic events, and wire all the Run control references to one, and all the Stop control references to another.&nbsp; Here's a screenshot...when the event fires, you can get the control label to figure out which button was pressed:&nbsp;<img src="Loading Image..." border="0"> &nbsp;Hope this helps,-D Message Edited by Darren on 08-15-2008 04:21 PM


dynamic_event.png:
http://forums.ni.com/ni/attachments/ni/170/349722/1/dynamic_event.png
ajf200
2008-08-15 21:40:20 UTC
Permalink
What about putting all of the Run buttons in one cluster, and all of the Stop buttons in another and have the events be On Value Change of the respective cluster?&nbsp; You could then have a subVI filter which button was pressed and then pass that info on to your control subVI.
Continue reading on narkive:
Loading...