Array of buttons and Event Structure

I have a the same problem... I was wondering if you were able to find a soln.
I have literally thousands of buttons and each button as a unique key code and unique name.
For Example :  
Button Name    – Key code #
PUSH              - 1
POP                 - 2
PULL               - 3
The way I program this simple algorithm is deadly painful. 
1)      I create 1000 buttons by going to control->buttons.
2)      Then I have to go through one by one to change the Boolean text to “PUSH,POP,PULL…”  
3)      Then used the Event Structure, adding in all the controls names “PUSH, POP, PULL..” In side each event, I placed the key codes “1,2,3..”
I have search and tried for weeks to find a better way, and still nothing comes to mind.  
Please help.

Hi Ben,
Thank you for your reply, I have attached my try_code and a picture of the code I currently have.  I  am new in Labview, but I am confident that, there must be a easier way to make an array of buttons with different button name and an associated number to that button.  
The 1st file, is to show you want I am currently doing, (painful)
The 2nd file attached is some of the things i tried, I had great hope with my try_code, array_jan25.  But I couldn't get it.  I think I am very close.
Thanks again,
Attachments:
ThePainfulWay.doc ‏63 KB
Array_jan25.vi ‏42 KB

Similar Messages

  • Radio Buttons and Event Structures

    Guys, I am hoping for some help here on something I probably should know but cant figure out how to do.  I am using a set of radio buttons and an event structure to run a UI.  The radio buttons are acting as both a user input and indicator of current status selected by the user.  I have the event structure set to run on value change of the radio button.  All works great unless the operator decides that he wants to repeat the selection that the radio button is already set to.  The event structure does not recognize this as a change of value and will not execute.  Is there a way to set the event structure up to run even if the same selection of the radio button is made a second time?  I attached a crude example to this post.  Basically everytime I press the button, I want an entry made into the text box, regardless if the selected item was already pressed.  Any thoughts.
    Troy
    Attachments:
    Radio Button Test.vi ‏16 KB

    Instead of hacking around the inherent nature of radio buttons, why not just use a Cluster?  Its behavior in the UI is more customizable.  Check this out:
    I just replaced your radio buttons with a cluster, and added a little logic to the event structure to get it to behave the way you describe.  I've attached the VI below, saved in 8.2, if you want to try it out.
    Hope this helps,
    -D
    Message Edited by Darren on 11-07-2006 10:45 AM
    Darren Nattinger, CLA
    LabVIEW Artisan and Nugget Penman
    Attachments:
    cluster_buttons.png ‏7 KB
    Cluster Test.vi ‏17 KB

  • Run-Time Menu and Event Structure~~HELP~~

    Hi, brothers,
    I'm new user for LabVIEW. Use the version of LabVIEW is 8.6
    One problem describe as below:
    Can Run-Time Menu and Event Structure exist simultaneously?
    Without Event Structure, Run-Time Menu works well, but Run-Time Menu works abnormally.after adding Event Structure,
    How do I modify the problem?
    Thank you for your help.
    Attached is the program.
    Attachments:
    PC_Adjustment.zip ‏44 KB

    Yes they can coexist, but not how you did it.
    Every iteration of the while loop you wait for an event in the event structure, and you look if the user has selected anything from the menu.
    To get this working you should add an event for <this VI>\Menu Selection (User):
    Ton
    PS you should add a stop button, the only way you can stop the VI is hitting the 'emergency stop' button, with hardware connected (like you have) this is not the adviced routine
    Message Edited by TonP on 09-26-2008 07:34 AM
    Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
    Nederlandse LabVIEW user groep www.lvug.nl
    My LabVIEW Ideas
    LabVIEW, programming like it should be!
    Attachments:
    Main_BD.png ‏5 KB

  • Connecting kurzweil sp88 to GB I want to connect my Kurzweil sp88 to GB. The Kurzweil has a baffling array of buttons and possible MIDI channels. It also has the old style MIDI plug ins. I've got the MIDI out connected to my MacBook Pro via USB adapter.

    I have my Kurzweil connected to my MacBook Pro via an adapter (old style MIDI from Kurzweil to USB adapter connecting to Mac). The Kurzweil has a baffling array of buttons and possible MIDI channels. Can anyone please tell me which of the channels I should use? Also, should I leave the MIDI In cable out of the Kurzweil? Thanks for as detailed an answer as possible. If you like you can respond directly to me at [email protected]

    First of all I do not own this keyboard. But a quick look at the manual (found on the internet) says that when first powered up the SP88 is in Internal Sounds mode. Meaning you hear the sounds selected when playing the keyboard. It also stated that the default Midi Transmit Channel is Midi Channel #1.
    Looks like you would need to go to the SP88 Keyboard's MIDI SETUP and simply select LOCAL OFF. Now the keyboard should be ready to transmit Midi Out only and no internal sounds should be heard.
    Next you may or may not need to do this but you might need to go into the Utilities Folder found in your Applications Folder on your Mac and double click AUDIO MIDI SETUP the keyboard Icon. Figure #1 below.
    Next you need to make a physical connection from the Midi Out of the SP88 to the Midi In on your Midi Interface. Figure #3 below. You may need to Click on Add Device first. Figure #2 below.
    In the examples shown below I have a Yamaha Electronic Drum Kit that is Midi Out only... not USB out. I had to plug a Midi cable from the Midi Out Port on the back of my Drum Module to the Midi In Port on the back of my Motu 828 Audio Inferface which is connected to my Mac. Next I created the Audio Interface and Drum Module "Devices" as mentioned above.
    I then double clicked on the Drum Module and made my Midi Out Selections. Figure #4 Below. And once it was setup and the icons closed I used my mouse to draw a virtual cable connection from the Drum Module Out to the Audio Interface In. Figure #3 below. This is how I got my Midi Devices to talk to one another.
    Once you have made your setup as I have outlined create a MIDI Instrument Track in Garageband, select an instrument for example a Piano then Record Enable that track in Garageband and see if you now hear what you are playing. In this example the SP88 is a Midi Controller only and you will only hear sounds selected in Garageband which is what you want.
    Keep in midi your setup may be different than mine. You can keep your SP88 Keyboard on the default Midi Channel #1. That would be a good place to start. Garageband receives Midi on all channels.

  • IOS Home Button and Event.ACTIVATE/Event.DEACTIVATE

    Hi all,
    I read tons of questions re iOS Home Button and Event.ACTIVATE/Event.DEACTIVATE. Everything should work well if you set the proper listeners and save/restore your app state upon receiveing these events.
    My question is: Is there a way to tell difference between a Home Button press and an iOS notification alert or incomming call? In both cases, AIR will dispatch Event.DEACTIVATE, however I want to know if the user pressed the Home Button or if he just received an SMS/Calendar alert, and adapt my app state accordingly - i.e. if it's a Home Button press, change my app state to "Main Menu", otherwise (SMS/Calendar/alert) I will pause execution.
    NOTE: I don't want to override the Home Button behaviour, just want to tell if it's a Home Button press or SMS/Calendar/alert, and react accordingly. The iOS documentation states that in case of SMS/Calendar/alerts, (void)applicationWillResignActive:(UIApplication *)application is dispatched, and in case of actually going to background state (i.e. Home Button pressed) (void)applicationDidEnterBackground:(UIApplication *)application is dispatched.
    Thanks

    Any luck with this yet? I'm having the exact same issues but on a different device, the Kindle Fire.
    I need to determine whether a user hit the Home button, or hit the Quick Settings button (that accesses controls like volume). Air treats both events equally by broadcasting Event.DEACTIVATE. Unfortunately, the Amazon Appstore approval team thinks otherwise...
    It seems like there should be a simple, no-brainer way to track these events, but I'm beginning to suspect Air just is not capable. In that case, if you're developing for Kindle Fire, you may want to avoid going with Adobe.

  • Numbers into textfield using boolean buttons and case structure?

    Hi!
    I'm very new to these forums, and to LabVIEW in general. I'm currently trying to implement a calculator-ish, but without the operations (+ - * /).
    I have 10 boolean buttons, named 0-9, and with these I want to basically write a sequence of numbers into a textfield. I've managed to solve the problem using an Event structure, but now i'd like to achieve the same result using a Case structure instead. The problem is that I can't identify which button has been pressed, so I can't make the program go to the correct case (0 to 9). Is there any simple solution to this that you guys could help me with? Maybe a property node that's generic for every button? I dont know
    Anyways, I'm attaching a simplified version of what I'm trying to achieve, withouh the code I don't know how to write obviously.
    Thanks for your help in advance!
    /Sebastian
    Solved!
    Go to Solution.
    Attachments:
    help.vi ‏12 KB

    Here is a way to do it: bundle the boolean values into an array, turn that into an 8 bit number and wire that to a case structure with a boolean radix
    Message Edited by jmcbee on 03-31-2009 02:29 PM
    CLA, CLED, CTD,CPI, LabVIEW Champion
    Platinum Alliance Partner
    Senior Engineer
    Using LV 2013, 2012
    Don't forget Kudos for Good Answers, and Mark a solution if your problem is solved.
    Attachments:
    helpMOD.PNG ‏13 KB
    helpMOD 80.vi ‏20 KB

  • How to implement boolean comparison and event structure?

    Hello all,
    I'm currently developing an undergraduate lab in which a laptop sends out a voltage via USB-6008 to a circuit board with an op-amp, the voltage is amplified, and then sent back into the laptop. The student is going to have to determine an "unknown" voltage which will run in the background (they can do this by a step test, graph V_in vs V_out and extrapolate to the x-axis).
    Currently, I have two loops that are independent in my VI. The first loop is used to "Set the zero." When 0 voltage (V_in) is sent out of the laptop it returns a value around -1.40V (V_out) typically. Thus, I created the first loop to average this value. The second loop, averages the V_out values that come into the laptop as the V_in numeric control changes. Then I take the "set zero" value from the first loop and subtract it from the second loop average to get as close to 0V for V_out when V_in is 0V.
    The problem I'm facing is, the event structure waits for the V_in numeric control value change, but after "SET ZERO" is pressed, if there is an unknown value, it will not be added to the average for V_out until V_in is changed by the user. So, I tried implementing a comparison algorithm in the "[0] Timeout Case." This algorithm works for step tests with positive values for V_in, but there are two problems.
    1) Negative values cannot be used for V_in
    2) If a user uses increasing positive values for V_in there is no trouble, but if they try to go back to 0, the value change event has been called and it is added to V_out as well as the timeout case.
    Sorry for the extremely long post, but I've been banging my head over this and can't figure out how to properly implement this. I'm using LabVIEW 8.0.
    Attachments:
    Average Reset Test.vi ‏371 KB

    OK you have bigger problems than Raven's Fan is pointing out.
    When the first event loop stops ( after pressing "") (the boolean text is "Set Zero")  The second loop may start- (AND PROCESSES all of the events it was registered to process before the loop started!)  that would enclude the value change event from "" (The boolean text is Stop) Being pressed bebore the loop started.  Of course, since the labels of "Set Zero" and Stop are identical nulls....................................................BOTH event trigger at the same time and are processed as soon as the event loop they are registerd to is available.
    Get it ... The two buttons labeled "" both queue Value change events to both loops registered to act on the value change of the control labled ""!
    Both loops will do what you programmed in the case of "" Value Change!  This can, (as you have observered) lead to confusing code actions.
    Do avoid controls with duplicate labels (There is a VI Analizer test for that!)  Do avoid multiple event structures in the same hierarchy. 
    DO NOT bring this to your studients to help you learn LabVIEW!  We get enough studii asking embarassing questions
    VI Analizer will help you provide sound templates.  If you need help with that hit my sig line- e-mail me and I'll always be willing to help.
    Jeff

  • While loop with stop button within event structure locks up front panel.

    I am not sure if this is a bug with my program or a bug within LabVIEW.  If you believe that this is a bug with my program then I will post my program to be looked at.
    The problem I am having is there is a while loop within an event structure that fires when a particular value changes.  Once the "Activate" button is pressed the while loop within the event structure starts going with a polling frequency of 1hz (1000ms wired to the "wait till next ms multiple" vi).  There is a "Deactivate" button that is wired to the stop control of the while loop and an outter while loop that resets the event structure so that the activate button is being listened to again.
    Once inside the while loop, however, none of the button are responsive within the front panel.  The VI continues to run, and only 60% of my CPU is being consumed, but none of the button or scroll bars work.  The only way for me to terminate the program is with the "Abort" button next to the "Run" button.  If I remove the event structure so that the while loop in question runs as soon as the program starts, the front panel remains responsive.  I've inserted probes within the while loop and verified that it is not running prior to the "Activate" button being asserted, and it is running after the assertion of the "Activate" button with the expected polling frequency set by the "wait till next ms multiple" vi.
    Can anyone help?  Do I need to post my code?
    -Nic

    It is typically not a good idea to stall an event structure by placing loops inside event cases. What good is an event structure if it is not free to repond to events?
    Have a look at some alternative solutions, such as in the following link:
    http://forums.ni.com/ni/board/message?board.id=170&message.id=224817#M224817
    LabVIEW Champion . Do more with less code and in less time .

  • How keyboard control Button in Event structure

    Hello
    First I am Just a beginner in Labview 
    I just make a program that Consist of 4 button controling 4 LEDs Using Event Structure
    The Problem is I did not want to operate the button by the mouse click but
    i want to operate the button using the arrow keys in keyboard
    T
    Attachments:
    Arrow key control LEDS.vi ‏10 KB

    Hi saiko,
    when you're a "total newbie" you should at first go through all those free online LabVIEW courses offered by www.NI.com!
    Try this:
    My stop and clear buttons also doesn't seem to wor​k when I put in the event structure.
    How did you configure the event case? When putting those buttons inside the event structure you have the tell that structure how/when to handle them. Did I mention the free online courses?
    but I can't get it to switch until release when I ​hold down on my keyboard.
    Do you want to use the automatic key press repeat feature? Well, you have to configure the event: right now it's "key press", but you probably want an event like "key repeat"? You may read the LabVIEW help on available events...
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Queues and event structure

    Hi,
    I'm having some troubles with a program that I'm doing.
    I think the big problem are in the queues and the structure event. I don't know why, but the elements in the queue only increase. And I think, because of that, some things that should happen, don't happen. For example, when I press the button "Impact" an square wave should appear, and it didn't appear.
    Thanks for all your help,
    Sílvia
    Attachments:
    Sonic.zip ‏115 KB

    sreis wrote:
    Hi,
    Of course I read your post, but like I said, I don't understand why, when I press the "Impulse" button, I have the start in the queue. I shouldn't have the previous used enum, because of the shift register?
    You are right, the things are slow down because of the re-enqueues and the many Acquire state I have in the queue. But how can I fix that?
    Thanks,
    Sílvia
    Yes the previous enum will be there because of the shift register.  But look at what is happening in your Acquire loop.  You are enqueueing on every loop iteration.  So your action is like this:
    Press Start - enqueue Initialize and Acquire
    Initilaize state runs
    Acquire state runs - Acquire is queued up again.  Because you have no wait state,  this loop runs super fast and you keep dequeueing acquire and queueing acquire again.  The wait state is imperative to allow the CPU time to process some other loops.  This is not done automatically, you have to allow it by adding waits to loops.
    Now you happen to press impact and somehow the CPU finds time to process the event.  What state gets queued?  Acquire again.  Now you have two acquires queued because the last Acquire state also queued an acquire.  Every button you press will enque something on top of what is already there and your dequeue will never be able to keep up.
    The solution is to not enqueue anything in the bottom loop.  Never do this.  If you want to acquire when no event is happeing, queue up the acquire in the Timeout event.
    - tbob
    Inventor of the WORM Global

  • 9x9 array of buttons and not a single button worked

    im trying to build a 9 x 9 block composed of buttons. I used array of buttons.
    here's my code with my explanation and poor logic thinking details.
    public class ButtonArrayDemo extends JFrame implements ActionListener
    private JButton[] sButton;
    private int[] x;//manipulation purposes only
    public ButtonArrayDemo()
         JPanel buttonPanel = new JPanel();
         buttonPanel.setLayout( new GridLayout(9, 9) );
         sButton = new JButton[81];
         x = new int[81];
    // creates the buttons,action listeners, syntax is correct but
    // i doubt the logic
         for (int i = 0; i < sButton.length ; i++)
              JButton button = new JButton();
              button.setText(" ");
              button.addActionListener(this);
              sButton[i] = button;
              buttonPanel.add(sButton);
              x[i] = 0;
         getContentPane().add(buttonPanel,BorderLayout.SOUTH);
         setResizable(false);
    // what i want for this is that, when a button is clicked, it displays the
    //number 1 then increments by 1 if clicked again. Like,when i click a
    //blank button, it displays the number "1", if i clicked it again, it displays
    //the number 2. This goes on until number 9. When the button is clicked
    //on the 10th time, it leaves the button's text blank. Syntax is fine but
    //i doubt the logic.
    public void actionPerformed(ActionEvent e)
         int y;
         for(y = 0; y < sButton.length; y++)
              if(e.getActionCommand().equals(sButton[y]))
                   sButton[y].setText(Integer.toString(++x[y]));
                   if(x[y] == 10)
                   sButton[y].setText(" ");
                   x[y] = 0;
    Now, i created the main and compiled the program. The frames appeared complete with 81 buttons. But, when I click on any button,
    it does nothing. The button's text which is supposedly to change is not displaying anything. this is a vital thinking process for me and any help from someone would be very much appreciated.
    thanks for reading and i hope someone will respond to my problem.
    lots of thanks.

    I believe the problem is that you are using the actionCommand but you did not set the actioncommand for the buttons. I suggest you either set the action command for each button to a unique item or use getSource instead.
    Also, you might want to break out of your for loop once you find the correct button.
    Also, if the future use the code formatting tags and this probably should have been in the Swing forum.

  • User interfaces and event structures

    I am just learning to use event structures to improve operation of front panels.  At the moment, I am working on a tab strucrture we use to montinor/set program paramters.  VArious parametera are displayed on each tab as controls (not indicators) and are constanly updated sice they can be modified elsewhere by other pieces of code.  We controls are normally disabled via a property node so they behave more like indicators and the values are updated by writing to a local variable (I know this is evil but it works in this case).  There is a boolean on each tab that toggles between "monitoring" and "changing" modes (or states).  When toggles to "changing" (or setting) parameters the monitoring activities are suspended and the control are enabbled.  After making the desired changes the controls are either read and the changes implimented or get rest based on some other boolean controls, the parameters controls are then disables and monitoring resumes.  The issue is that many users fing the need to toggle between "monitorsing" and "changing" modes to be confusing.  I want to replace this switch with an event.  If the user clicks on any of the parameters controls in a tab, I want to go into changing mode rather than using the "monitoring"/"changing" boolean control.  All other asspects are handled as before.  My problem is than if I use a mousedown event to go into "changing" mode and the user clicks on several parameters to shift the keyboard focus to edit more than one parameter, these subsequent mose clciks get processed as new events when change mode is exited.  This means that as soon as it returns to "monitoring" mode it jumps immeadiately back to "changing" mode.  How should I structure the events to avoid this problem?
    Thanks,
    --Lee

    Lee,
    Instead of using a "mouse down" event, use a "value change" event for each
    of the controls. Then your program can switch to the "changing" mode
    whenever the value of the control is actually changed.
    TJW
    "Lee Robertson" <[email protected]> wrote in message
    news:[email protected]...
    >I am just learning to use event structures to improve operation of front
    >panels.&nbsp; At the moment, I am working on a tab strucrture we use to
    >montinor/set program paramters.&nbsp; VArious parametera are displayed on
    >each tab as controls (not indicators) and are constanly updated sice they
    >can be modified elsewhere by other pieces of code.&nbsp; We controls are
    >normally disabled via a property node so they behave more like indicators
    >and the values are updated by writing to a local variable (I know this is
    >evil but it works in this case).&nbsp; There is a boolean on each tab that
    >toggles between "monitoring" and "changing" modes (or states).&nbsp; When
    >toggles to "changing" (or setting) parameters the monitoring activities are
    >suspended and the control are enabbled.&nbsp; After making the desired
    >changes the controls are either read and the changes implimented or get
    >rest based on some other boolean controls, the parameters controls are then
    >disables and monitoring resumes.&nbsp; The issue is that many users fing
    >the need to toggle between "monitorsing" and "changing" modes to be
    >confusing.&nbsp; I want to replace this switch with an event.&nbsp; If the
    >user clicks on any of the parameters controls in a tab, I want to go into
    >changing mode rather than using the "monitoring"/"changing" boolean
    >control.&nbsp; All other asspects are handled as before.&nbsp; My problem
    >is than if I use a mousedown event to go into "changing" mode and the user
    >clicks on several parameters to shift the keyboard focus to edit more than
    >one parameter, these subsequent mose clciks get processed as new events
    >when change mode is exited.&nbsp; This means that as soon as it returns to
    >"monitoring" mode it jumps immeadiately back to "changing" mode.&nbsp; How
    >should I structure the events to avoid this problem?
    > &nbsp;
    > Thanks,
    > &nbsp;
    > --Lee

  • Datasocket and Event Structure.

    I have developed a labview aplication that control some pumps and send the setpoint to some PID controllers in my test laboratory. this aplication run fine with Event Structure. I have developed too, a small labview software that use Datasocket to connect to previous software, the problem is that when i press a control from client (the control change in server) the Event structure don´t detect the "value changed" event, why? How could I find a solution?
    Thanks in advance

    Hi!
    I came up, with this simple solution and it works with my datasocket appz.
    Have a nice day!!
    Attachments:
    prog2.JPG ‏15 KB
    fronpanel.JPG ‏11 KB
    prog1.JPG ‏16 KB

  • Array of Cluster with event structure

    Hi,
    I am having Array of cluster with cluster having 1 String Control , 1 Combo box, 1 Led control and 2 Numeric control. In the combo box i am having two options to select ('Binary' and 'PWM').Whenever Binary is selected then Led control has be enabled and whenever PWM is selected 2 Numeric control has to be enabled.
    Is there any way to do this??
    Pleas help me...
    Regards
    Meenatchi

    actually in my application, the front panel has to have 16 rows of controls (1 string control, 1 combo box, 1 Led control, 2 numeric control).so i planned to keep all those controls in a cluster and create one array.If i didnt so i will have 16x5 controls in my front panel and i have to put 16 event cases for each combo box to do the enable and disable of controls..
    is there any simple way to do this..i have attached my front panel view
    Attachments:
    Untitled10.vi ‏139 KB

  • Html buttons and event handlers

    There are three html buttons, each of them takes the user to a particular page once selected. I know an onClick method as follows but what comes after this??:
    out.println("<P ALIGN=CENTER ><INPUT TYPE=submit value=ENTER onClick...............>");
    If anyone knows let me know.
    thanks in advance,
    raj

    onClick = 'functionName(argument1, argument2,...)'
    typically you define a method that conducts necessary work(if any) and then loads a new page.

Maybe you are looking for