Menu Design using Event Handler and Containers

I am going to redesign my menu interface using a Labview Event Structure which has many control on tab pages.  I want to start out doing the correct design approach here.  By registering the front panel controls[] property as an event, I can write event cases for each of the controls on the front panel.  However, I run into difficulty when I have controls on tab pages.  I have attached a VI which shows how I want to set it up.  The event hanlder only fires when I change pages on the tab control. 
What is a good way to be able to decipher individual controls on the tab control and
what is the characteristic (label, ref number, etc) that I should be writing the event cases on for good code maintenance? 
Solved!
Go to Solution.
Attachments:
Generic Menu.vi ‏14 KB

Looking at your code, you registered for value change events for controls on the front panel, not in the tab control. Use the property node for the tab control to get the references to the pages and for each page get the references for the controls on that page. Build an array of all controls on all pages (or you could separate the registration for each page to make your life easier potentially) and register those controls for value change events. See below...

Similar Messages

  • RMI, event handling, and Winow.dispose()

    Hi all,
    If you combine RMI with an event handler and java.awt.Window.dispose(), the JVM hangs. The only way to solve this problem is by disposing of the frame from within SwingUtilities.invokeLater.
    Please check the following code:
    ServerInterface.java:_
    import java.rmi.Remote;
    import java.rmi.RemoteException;
    public interface ServerInterface extends Remote {
        void Send(ClientInterface CI) throws RemoteException;
    ClientInterface.java:_
    import java.rmi.Remote;
    import java.rmi.RemoteException;
    public interface ClientInterface extends Remote {
        void Send() throws RemoteException;
    Server.java:_
    import java.rmi.RemoteException;
    import java.rmi.server.UnicastRemoteObject;
    import java.rmi.Naming;
    public class Server extends UnicastRemoteObject implements ServerInterface {
    public Server() throws RemoteException {}
    public void Send (ClientInterface CI)
    try { CI.Send(); } catch (Throwable t){System.out.println(t);}
    public static void main(String args[])
    try {
          Naming.rebind      ( "rmi://localhost:1099/Testing",new Server() );
          System.err.println ("Server ready");
    catch ( Throwable t )
            System.out.println ( t );
    Client.java:_
    import java.rmi.RemoteException;
    import java.rmi.server.UnicastRemoteObject;
    import java.rmi.Naming;
    import java.awt.event.ActionListener;
    import java.awt.event.ActionEvent;
    import javax.swing.SwingUtilities;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JButton;
    public class Client extends UnicastRemoteObject implements ClientInterface,ActionListener {
    static JFrame A=null;
    static ServerInterface ServerSide;
    private Client()  throws RemoteException {}
    public void Send()
    if ( A == null )
         A = Display("Remove");                   // display frame
    else                                // remove frame
         SwingUtilities.invokeLater ( new Runnable(){public void run(){A.dispose();A=null;}} );
    public static void main(String[] args)
    try {
          ServerSide = (ServerInterface) Naming.lookup ( "rmi://localhost:1099/Testing" );
          ServerSide.Send(new Client());
    catch ( Throwable t )
            System.out.println ( t );
    public void actionPerformed(ActionEvent e)
    try { ServerSide.Send(new Client()); } catch (Throwable t){System.out.println(t);}
    private JFrame Display (String label)
    JButton b = new JButton (label);
    b.addActionListener(this);
    JPanel p = new JPanel ();
    p.add (b);
    JFrame frame = new JFrame ();
    frame.getContentPane().add(p);
    frame.pack();
    frame.setVisible(true);
    return frame;
    }You can do any GUI work from within an event handler, only when you try to dispose of a frame, the system hangs !!!

    Thank you for responding to my problem.
    unless their documentation says otherwise (eg: repaint). I checked the API for "repaint()", but it didn't mention anything about the EDT. What documentation you are referring to ?
    What I don't understand is that why "dispose()" works well on non-RMI systems and hangs the machine on RMI systems ? It even works fine on RMI system providing that you are not disposing of the frame from within an event handler. So the problem occurs only if you are combining the three elements: RMI, event handler, and dispose().
    Conversely, you should avoid doing anything that may take a long time on the EDT. Perhaps remote methods fall into that category.It is true that we should avoid doing anything that may take a long time on the EDT; however, in this particular example, dispose() is not done through a remote call, it is done on the client where the frame should be removed.
    I also tried disposing of the frame from within a normal Thread (instead of the EDT), and it worked just fine.

  • Use event handler programmatically

    Hello, I use the Labview 8.2.1 and I would like to ask something about event handler.
    I have some buttons and I use an event handler to perform their tasks. The buttons are used only with the mouse and not programmatically.
    Now, I want to use a button programmatically without pressing it. I didn't find how to do this, so I created a boolean variable and I added to the event handler of a button a second "Event Specifier" of that boolean variable with the event "value change".
    I assumed that it would work, but it does not, that is, the event handler is not used when the value of the boolean variable changes.
    How can I solve it?
    Thank you in advance.
    Solved!
    Go to Solution.

    Write to the Value(Sgnl) property node of the variable you want to change.  This will set off an event programatically.
    - tbob
    Inventor of the WORM Global

  • Event handling and inner classes

    Hi everyone,
    When assigning an actionlistener object to a swing component, is making the encapsulating component implement actionlistener better performance-wise than using inner classes? I ask this because my application is pretty slow to start-up, and I'm using lots of inner classes.
    I don't want to go ahead and change the event-handling unless I'm sure it will do any good, because the time restriction is too tight for wasting. Does using addActionListener(this) just pass a reference to itself or is an object generated for each call?
    Thanks in advance,
    Richard

    Passing this only passes a reference. But you won't get a big improvement over inner classes. (If you use one listener object instance and pass that instance to the event sources. Do you?)
    Kurta

  • How do i exit a while loop using event handler

    Hello,
    I have an event handler structure within which i run a while loop for a particular event. I would like to interrupt the execution of this while loop as soon as another event occurs, even if the while loop has not finished execution. I have tried so many ways, the best i could get is exiting one itteration after the new event occurs which is no good for me.
    Any suggestions???
    Thanks
    Me

    Instead of having a task while loop in an event case, put your task while loop in parallel with the loop surrounding the event structure. When the event which should start the task occurs, you can signal the start of the task while loop. You could use local variables of references to start/stop the loop when an event occurs. You could also use notifiers instead of variables to pass signals to start/stop the while loop. In general you should have a while loop for the event structure, and a parallel while loop to do the tasks. The parallel loop is controlled by variables or notifiers which are set in the event cases.
    - tbob
    Inventor of the WORM Global

  • USER LOGIN GENERATION USING EVENT HANDLER IN OIM 11G

    Hi
    I am looking to generate user logins in OIM 11g (11.1.1.5) using event handlers. Can anyone guide me with the process and which API need to be used?
    Regards

    You have to write your custom class which implements oracle.iam.identity.usermgmt.api.UserNamePolicy. Then you have to register the plugin which will contain the plugin.xml and class file of your custom code.
    More in this metalink ID 1228035.1

  • How open a service order using event handling

    HOw to open a service order using event handling

    Hi,
    Can you explain your requirement elaborately.
    I understand from it as, you want to open Service order creation page, based on some event(may be submit button).
    For that technically you can use navigation->goto_page('Provide the URL').
    or you can use inbound-plug and out-bound plug concept for naviagation.
    Regards,
    Devender V

  • How to Update multiple items in other list using event handler?

    Hi All,
    If i update a item in a list, then i should update multiple items in another list need to be update. How to achive using event receivers?

    Hi Sam,
    According to your description, my understanding is that you want to update multiple items in another list when updated a list item.
    In the event receiver, you can update the multiple item using Client Object Model.
    Here is a code snippet for your reference:
    public override void ItemUpdated(SPItemEventProperties properties)
    string siteUrl = "http://sp2013sps/sites/test/";
    ClientContext clientContext = new ClientContext(siteUrl);
    List oList = clientContext.Web.Lists.GetByTitle("another list name");
    ListItem oListItem = oList.GetItemById(1);
    oListItem["Title"] = "Hello World Updated!";
    oListItem.Update();
    clientContext.ExecuteQuery();
    Best regards,<o:p></o:p>
    Zhengyu Guo
    Zhengyu Guo
    TechNet Community Support

  • ICal Event Handling And Exchange

    Okay. I'm having problems figuring out how iCal in Snow Leopard is handling meeting invitations. When I get a new meeting invite in Mail.app and I double-click on it, it creates an event in iCal. If I open that event, the popup gives me the option to click on "Maybe", "Accept", or "Decline". If I click on "Accept" the event window goes away and iCal comes back up.... but it doesn't appear to save my response. If I click on the event, it still shows me the same button options. This would all be fine... except for the following issue....
    As long as an iCal event is in the "invitation" state, I can't change the event from it's default local calendar to the Exchange calendar. I can move it around within local calendars, but the Exchange options are not available from the pulldown menu. If I create a new event manually, then the Exchange options are available from the pulldown and I can move events to it just fine.
    I can't figure out how to get invitations (1) accepted and saved as accepted and (2) moved to the Exchange calendar.
    Anyone have any ideas?

    I've found a work-around that SORT of lets me function for now:
    1) Right click on the event.
    2) Select "Create Duplicate"
    3) Right-click on the new duplicate.
    4) You can now select your Exchange calendar to move it over.
    5) When you try to select the OLD event, iCal will REQUIRE that you send a notification out to the meeting invitees. This is ENTIRELY too inconvenient for me (as I work for Government and Army Colonels do NOT want my meeting spam) so I click on EDIT and then remove all the invitees and then save. This gets around the requirement to send the notice.
    6) THEN I can select the OLD event on my local calendar and delete it.
    This is FAR from a good solution as it requires me to lose all the meeting attendee information AND there's something broken in the requirement to send the meeting notice out again for the duplicate.. but at least I can get events onto my Exchange calendar for now.

  • Event handling and jeditor

    HI, I am having a problem and tied down just because of this.
    I have an action listener code that is executed when button is clicked, and here what i do in that
    JeditorPane.setPage(URL url)
    callToMethod2();
    Method2
    some calculation
    and when i check the length of the document for the jeditorPane it gives me 0
    this is because the page is not yet laoded as it contains images.
    Actually i want this method2 to be called after whole pages is loaded and displayed
    How can i do this
    regards

    API:
    If the document is loaded asynchronously, the document will be installed into the editor immediately using a call to setDocument which will fire a document property change event, then a thread will be created which will begin doing the actual loading. In this case, the page property change event will not be fired by the call to this method directly, but rather will be fired when the thread doing the loading has finished. It will also be fired on the event-dispatch thread. Since the calling thread can not throw an IOException in the event of failure on the other thread, the page property change event will be fired when the other thread is done whether the load was successful or not.
    So, don't put your call to method2 after the setPage. Rather, attach a property change listener for "page" to get the event described above, and in the propertyChange method, call method2. See if that works for you.
    -JBoeing

  • Use event structure and while loop in parallel

    Hello, I would like to use an event structure in parallel with a while loop. I have a camera that needs to constantly take pictures and I have that setup in the while loop. I also however need to do other functions in conjunction with the picture taking. I have about 50 or so events that need to have access to while the pictures are taken. Is there any way to do this? If not is there any way to have a global stop variable that is attached to all 50 of the events. I know I can do this the hard way and have each boolean event in the event structure be attached to the while loop stop control. This is however very inefficient. I would also like to know if I can simply use a mouse click as the stop of the while loop. Am I able to have a variable that goes from false to true on mouse click without using the event structure to do this? Thanks.

    Yes, just place the event structure in a second while loop.
    Add a stop button to the other while loop and add an event for the stop button to stop both loops. For a simple example, see my VI posted here:
    http://forums.ni.com/ni/board/message?board.id=170&message.id=176367&jump=true
    Simply add more event cases as needed.
    LabVIEW Champion . Do more with less code and in less time .

  • Event Handler and Callback Registration - Business Transaction - SAP Library

    To add a comment, please log in or register on the top of this page and choose Reply. Please write your comment in English.
    You can also go back to the SAP help page.

    Hello,
    To implement any process for BERP.
    1. Tcode BF24 - Create a product. Let's say Z1130.
    2. Tcode BF44 - Create new entry with
    Process - 00001130, FM - ZTEST_1130, Product - Z1130.
    Save Entry.
    3. Tcode BERP - Give Process Interface as 00001130. Run.
    4. You will see one entry. Put cursor on that and Click on Act. Comp.
    5. Here you can see your FM - ZTEST_1130 as Customer product.
    Now, put your relevent code in ZTEST_1130. You can pass tables like
    *" T_BKPF STRUCTURE BKPF
    *" T_BSEG STRUCTURE BSEG
    SO, in your FM, you can get access to data for BKPF and BSEG
    Regards,
    Naimesh Patel

  • How to add event handling for a menu?

    hi,
    I have created a menu and few mneu items.
    for eachmenu itme , i did event handling and it is workign fine.
    it was like this
    menuItem = new JMenuItem("Exit",KeyEvent.VK_X);
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, ActionEvent.ALT_MASK));
    menuItem.addActionListener(this);
    menu.add(menuItem);
         public void actionPerformed(ActionEvent e)
    JMenuItem source = (JMenuItem)(e.getSource());
    String s = "Action event detected. Event source: " + source.getText();
    System.out.println(s);     
    public void itemStateChanged(ItemEvent e)
    JMenuItem source = (JMenuItem)(e.getSource());
    String s = "Item event detected. Event source: " + source.getText();
    System.out.println(s);
    now int he second menu i don't have any menu item and i want to do the event handling for the menu itself. any ideas how to do it. following is the code for the menu
    //Build the second menu.
    menu2 = new JMenu("Options");
    menu2.setMnemonic(KeyEvent.VK_O);
    menuBar.add(menu2);
    menu2.addActionListener(this);     //this does nto work

    You were on the right track. However, selecting a menu is different from selecting a menu item. MenuItem chucks an ActionEvent and Menu will send an ItemEvent.
    If you pile all action output to one actionPerformed method then be careful of your assumptions on what the source type will be. If by any chance the Menu has sent an ActinoEvent then your code will have caused a ClassCastException.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class MenuTest implements ActionListener, ItemListener {
        JMenuItem menuItem;
        JMenu menu1, menu2;
        JMenuBar menubar;
        JFrame frame;
        public MenuTest() {
            frame = new JFrame("MenuTest");
            frame.setDefaultCloseOperation(frame.EXIT_ON_CLOSE);
            menubar = new JMenuBar();
            frame.setJMenuBar(menubar);
            menu1 = new JMenu("File");
            menu1.setMnemonic(KeyEvent.VK_F);
            menuItem = new JMenuItem("Exit",KeyEvent.VK_X);
            menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, ActionEvent.ALT_MASK));
            menuItem.addActionListener(this);
            menu1.addItemListener(this);
            menu1.add(menuItem);
            menubar.add(menu1);
            //Build the second menu.
            menu2 = new JMenu("Options");
            menu2.setMnemonic(KeyEvent.VK_O);
            menu2.addActionListener(this); //this does not work
            menu2.addItemListener(this); // use this instead
            menubar.add(menu2);
            JPanel panel = new JPanel();
            panel.setPreferredSize(new Dimension(100,100));
            frame.getContentPane().add(panel);
            frame.pack();
            frame.show();
        public void actionPerformed(ActionEvent e)
            String s = "Action event detected. Event source: " + e.getSource();
            System.out.println(s);
        public void itemStateChanged(ItemEvent e)
            String s = "Item event detected. Event source: " + e.getSource();
            System.out.println(s);
        public static void main(String[] args) {
            new MenuTest();
    }

  • Event handler switch creation (for repeated use )

    Im creating a hyperterminal like application which reads from serial port and  writes into serial port.
    The reading and writing works almost fine..I also wants to create some custom "Key controls" that will send some prestored commands to the serial port.
    I currently implemented two commands "ESC" and "FLASH " in the Key controls menu..
    I want to send these commands ESC and FLASH each time i click a button in the menu.
    I used event handler for it..and put the event handler inside an always running while loop.
    But the problem is I can send only these commands only for one time during execution.
    Repeated pressing of switches doesnt cause any effects..
    Can somebody help please???
    Im using labview 6.1. If u modify VIs using higher versions i cant open here..kindly include a jpg screenshot inthat case.
    Thanking you.
    Stephen.
    Attachments:
    Serial Port(stable release)1.2.vi ‏113 KB
    Init.vi ‏32 KB
    Write.vi ‏44 KB

    Hi Stephen,
    in LV7.1 your events will be executed whenever I press one of the according switches...
    Notes:
    -Don't make several event structures. Instead make one event structure with several event cases. Read the context help for the event structure!
    -I would suggest to set the mechanical action of both switches to "latch when pressed" instead of "switch..." to give a feedback to the user as the switch will be reset after reading it...
    -Generally be more styleguide-conform! Use right-click on terminals to create controls/constants to avoid coercion dots (spot the red colored dots in the image?). Make error in/out in the lower left/right of the connector pattern. Avoid block diagrams larger than the screen (or what kind of monitor do you use?).
    Edited:
    Sorry for weird display. I have to get used to the new image gallery feature of the forum (and will use "image to the left" only on rare conditions). Btw. the preview looks different to the actual post
    Message Edited by GerdW on 05-28-2009 06:59 AM
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Event handler getting fired on all list and libraries

    I have created an event handler and add it to a custom content type. Some how this event handler is getting fired on each every list which are there inside a site. Below is my content type declaration with fields and event handler. This content type
    is being activated using a featur scope at "Site".
    <?xml version="1.0" encoding="utf-8"?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <!-- Parent ContentType: Document (0x0101) -->
    <ContentType ID="0x01010069131024FE3C485FAEF6C36926B5FD67" Name="CIB Document" Group="CIB Content Types" Description="CIB Content Types" Inherits="FALSE" Version="0">
    <FieldRefs>
    <RemoveFieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Hidden="TRUE" Name ="Title"></RemoveFieldRef>
    <FieldRef Name="Metier"
    ID="{F3ABF2F2-437B-4403-8A11-BEAE9F507009}"
    DisplayName="Metier"
    Sealed="TRUE"
    Required="FALSE" />
    <FieldRef Name="Department"
    ID="{0B11D33C-B8D1-485F-A483-755BFE55C2B9}"
    DisplayName="Department"
    Sealed="TRUE"
    Required="FALSE" />
    <FieldRef Name="Owner"
    ID="{FC6FE3D4-5EEE-4812-A77C-499AB9927D1A}"
    DisplayName="Owner"
    Sealed="TRUE"
    Required="FALSE" />
    <FieldRef Name="ExpiryDate"
    ID="{D68E037B-63A2-42FF-8150-412972CB062F}"
    DisplayName="Expiry Date"
    Sealed="TRUE"
    Required="FALSE" />
    <FieldRef Name="SecurityStatus"
    ID="{5954E9C2-921B-46FB-8A7B-2BC0F62BD011}"
    DisplayName="Security Status"
    Sealed="TRUE"
    Required="FALSE" />
    </FieldRefs>
    <XmlDocuments>
    <XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/events">
    <spe:Receivers xmlns:spe="http://schemas.microsoft.com/sharepoint/events">
    <Receiver>
    <Name>CIBDocumentHandlerItemAdding</Name>
    <Type>ItemAdding</Type>
    <Assembly>Common.SharePoint.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=68d03adf96d84a47</Assembly>
    <Class>Common.SharePoint.Web.Handlers.CIBDocumentHandler</Class>
    <SequenceNumber>10500</SequenceNumber>
    </Receiver>
    </spe:Receivers>
    </XmlDocument>
    </XmlDocuments>
    </ContentType>
    </Elements>

    You need to add the ListTemplateId or ListUrl to the Receiver element,
    E.g. If you had a list definition with the template ID 10500, then your event receiver XML would look like this:
    <?xml version="1.0" encoding="utf-8"?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <Receivers ListTemplateId="10500" >
    <Receiver>
    <Name>CIBDocumentHandlerItemAdding</Name>
    <Type>ItemAdding</Type>
    <Assembly>Common.SharePoint.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=68d03adf96d84a47</Assembly>
            <Class>Common.SharePoint.Web.Handlers.CIBDocumentHandler</Class>
    <SequenceNumber>10500</SequenceNumber>
    </Receiver>
    </Receivers>
    </Elements>
    Regards, Matthew
    MCPD | MCITP
    My Blog
    Please remember to click "Mark As Answer" if a post solves your problem or "Vote As Helpful" if it was useful.

Maybe you are looking for