Event case double action

Hello, I made a VI which consists of two tabbed pages. Each page has three buttons-> you measurement procedures

At the start of the VI, always the initialization is performed. When to switch between pages, always initialization is done.

Everything works well except: when passing between pages, the initialization is performed two times!

How to avoid this?

In general, the controls on the tab are a visual aid for the façade to the group as controls.  The terminal is not connected to what whether in code.

It looks like you want a "state machine".  Search the forums and the help of LabVIEW.

Your code is essentially internal to the outside at the moment.  You must only have a unique structure and make the outermost structure (just inside the outermost program while loop).

In the case of event appropriate (one per action/event) use a business structure that determines which code to run in function your different measurement procedures.

Tags: NI Software

Similar Questions

  • How does an event undesirable (motor Action) end

    All,

    I looked at an example AE for the forum. It does not work.

    My question is what prevents the AE when it is hardcoded with a Boolean value (True)?

    Thank you

    Ben wrote:

    I read that as 'don't browse once only' giving me the chances of the philosophical question;

    If it covers several times can he still called an AE?

    I love "THINGIES" in my application that can browse more than once. An example is a "security Thingie" that will make the security controls to allow the selected operation to proceed. I've implemented within a framework of pseudo-AE to force the other thread to wait while the audit is completed.

    Someone at - it care to comment on this idea?

    Ben

    Perform more advanced functions could fall into the 'Action' category, but then it is different from a regular sub - vi?

    1. given that EI is a FG on steroids that we must infer that some memory based on shift registers is involved

    2 "party action" means that we can have several functions (generally less Init, Get, Set). Nothing limits really these individual action to use loops and sub - vi, e.g. a 'median Get '.

    3. However, if these actions of the chain we suddenly have a state machine!

    Thus, an adverse event must be a running state machine unique storage memory function.

    /Y

  • Z3 case double

    Hello. I'm new here. I can't find any accessories for my new Z3 double due to the difference in design between her and the Z3. Not even on the official site of Sony. All cases on Amazon are z3 to z3 compact.
    Any suggestions? Thank you.

    Hello

    I ordered two Xperia Z3 Mobile Fun case (see below), both these mounted my Z3 double without any problem.

    149550 case-Mate barely there Sony Xperia Z3-case - Black 14.99 GBP

    149131 FlexiShield Sony Xperia Z3 case - Frost White 5.99 GBP

    Hope helps!

    Andrew

  • Video stop event COMPLETE and action

    Hello, I am a demand for an exhibition and is necessary to restart to start itself if it is innactiv, for other visitors.

    I use

    addEventListener (Event.ENTER_FRAME, fl_EnterFrameHandler);

    function fl_EnterFrameHandler(event:Event):void

    {

    MovieClip (this.root) .gotoAndPlay (1, "Scene 1");

    }

    For most of my sequences, but when it's for the pages of the video, I have a question:

    I have a PlaybackFLV video on my 'sequence 4' and I want to return to the Sequence 1 when this video is over

    I tried whith, copy the following code:

    @

    Import fl.video.FLVPlayback;

    Import fl.video.VideoEvent;

    comp.addEventListener (Event.COMPLETE, videoComplete);

    function videoComplete(Event:Event):void {}

    MovieClip (this.root) .gotoAndStop (1, "Scene 1");

    }


    and


    Import fl.video.VideoEvent;

    video_secret_fab_EN.addEventListener (VideoEvent.COMPLETE, videoComplete);

    function videoComplete(Event:VideoEvent):void {}

    MovieClip (this.root) .gotoAndStop (1, "Scene 1");

    }

    But I always get this message:

    004, layer 'Actions', Image 28056 sequence, line 55, column 611119: Access the FULL maybe property not set through the static class type reference.

    Sequence 004, layer 'Actions', Image 28056, line 55, column 61 1119: access to the COMPLETE poperty can be undefined, via the type of reference a static class. (Sorry I'm french and not bilingual...)

    I am new to AS3 and I don't know what the problem is.

    I don't want to use a timer, because I have to integrate the same code for multiple video pages in my project.

    Thank you for your attention and hope you can help me.

    I think that the event Complete for FLVPlayback uses only the standard event class:

    import flash.events. *;

    comp.addEventListener (Event.COMPLETE, videoComplete);

    function videoComplete(e:Event):void

    {

    MovieClip (this.root) .gotoAndStop (1, "scene 1");

    }

  • Event case + while loop (the controls inside the loop will not be updated)

    Ok. I don't know what I'm doing wrong.

    But when I press Start, I can't move the slider control.

    All the obvious errors here?

    Bob123456 wrote:

    But when I press Start, I can't move the slider control.

    Your event is set to lock the front until the end of the event. This means that you are in a bind, because the event cannot be completed until the button is pressed, which can happen because the FP is locked.

    Quick "bandaid fix" would be to uncheck this option in the configuration of the event. Not recommended!

    You should never place interactive code within the structures of the event. Restructure your code accordingly. See state machines, for example.

  • IntelliType resulted in double action

    I noticed recently that IntelliType can cause double acts.

    For example,.

    After rebooting, pressing the Calculator button on my keyboard Microsoft opens 2 calculators, not one.

    If I kill itype.exe, none are open

    itype.exe, now a sinlge will be opened to restart

    What could be the problem?

    Thank you

    Hello

    Thank you for your response.

    I suggest you to download and install mouse and keyboard Centre 2.3 (formerly IntelliPoint IntelliType Pro) from the link provided below and check:

    Mouse and keyboard Centre 2.3 (formerly IntelliPoint IntelliType Pro)

    http://www.Microsoft.com/en-US/Download/details.aspx?ID=42510

  • Can I set up Lightroom to use all my carrots in the case of actions such as import?

    Hello!

    I have a processor with four cores and hyperthreading also compatible.

    But if I do an import in Lightroom uses the best 25% of my overall performance of the CPU.

    If he would start the low number of threads prio, it would speed up my import much, as I import very often 2 000 up to 8 000 photos.

    In my case, it could accelerate the process of factor 4. And it would be great, such as an Intel Core i7 to 3.4 GHz also has a lot of work to do, so the import of 2 000 images takes in my minutes case maybe 15 or 20. I have not looked at the time.

    Are there opportunities, tell Lightroom to use multiple threads and spread over all the (virtual) processors?

    Best regards

    There is no medium in the application itself to change how/when Lr uses cores available. There may be some developer tools available from Microsoft or Apple which allow a control, but you would use them at your own risk.

  • Controls that trigger cases of timeout event structure

    In a structure of the event, we can understand the controls in the event of timeout. But if we do it this way, we do not get event data node associated with the controls. I don't know if it is a good practice and whether there are issues listed. Please comment. Thank you.

    guangdew1 wrote:

    In a structure of the event, we can understand the controls in the event of timeout. But if we do it this way, we do not get event data node associated with the controls. I don't know if it is a good practice and whether there are issues listed. Please comment. Thank you.

    A 'practice', it's what you do. You talk about a limitation (or characteristic). Event data nodes display only those items that are common to all the events of this particular event case, so for example "old/new val" is not available if there is also a timeout that is assigned. If you do not need them, it does not matter whether they are there or not.

    This often isn't a problem because you usually only the new value and you can get that by placing the terminal control inside this event.

    If you need the specific event data node, create an otherwise empty case event dedicated to control and raise the timeout event temporarily affecting the timeout to zero using a shift register. Set the time-out period to zero in the case of timeout events. If the new value is also necessary in the case of a time-out, leave the Terminal inside event newval event data node timeout usage in the case.

  • Use the same graphical display of data from the different cases of event Structure

    Hello

    I would like one graph to view the input data and modified by one of the two cases of different event structure.  So if the event 1 is selected by the user, the data would be entered by the code contained in 1 case and then introduced in a waveform to display chart.  If the event case 2 is selected, similar data would enter the 2 cases but then displayed by the same graphic waveform , as in case 1.  I don't know if there is a way to do this... it seems that each case of the event would need its own array of waveform, but it becomes quickly heavy regarding the graphical interface for the multiple cases of event.

    Advice would be greatly appreciated!

    Thank you

    Mike

    You are allowed to put the business structures in the case of timeout.

  • How to raise an event during the double click on a tree node

    I have this code that creates the new tab in a remote Java class.

    treeView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<TreeItem<String>>()
       {
       @Override
       public void changed(ObservableValue<? extends TreeItem<String>> observable, TreeItem<String> oldValue, TreeItem<String> newValue)
       {
       System.out.println("Selected Text : " + newValue.getValue());
       // Create New Tab
       Tab tabdata = new Tab();
       Label tabALabel = new Label("Test");
      tabdata.setGraphic(tabALabel);
    
       DataStage.addNewTab(tabdata);
       }
       });
    

    Can you tell me how I can change the code to open a new tab when I double click a tree node. In my code, the tab opens when I click once. What event handler do I need?

    import java.util.Arrays;
    
    import javafx.application.Application;
    import javafx.event.EventHandler;
    import javafx.stage.Stage;
    import javafx.scene.Scene;
    import javafx.scene.input.MouseEvent;
    import javafx.scene.layout.StackPane;
    import javafx.scene.control.TreeCell;
    import javafx.scene.control.TreeView;
    import javafx.scene.control.TreeItem;
    import javafx.scene.control.SelectionMode;
    import javafx.util.Callback;
    
    public class TreeTest extends Application {
    
      public static void main(String[] args) {
        launch(args);
      }
    
      @Override
      public void start(Stage primaryStage) throws Exception {
        primaryStage.setTitle("TreeView Test");
        primaryStage.setScene(createScene());
        primaryStage.show();
      }
    
      private Scene createScene() {
        final StackPane stackPane = new StackPane();
        final TreeView treeView = new TreeView();
        treeView.setRoot(createModel());
        treeView.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
    
        treeView.setCellFactory(new Callback, TreeCell>() {
          @Override
          public TreeCell call(TreeView treeView) {
            return new ClickableTreeCell();
          }
        });
        stackPane.getChildren().add(treeView);
        return new Scene(stackPane);
      }
    
      private TreeItem createModel() {
        TreeItem root = new TreeItem("RootNode");
        TreeItem packageA = new TreeItem("package A");
        packageA.getChildren().addAll(
            Arrays.asList(new TreeItem("A1"), new TreeItem("A2"), new TreeItem("A3"))
        );
        TreeItem packageB = new TreeItem("package B");
        packageB.getChildren().addAll(
            Arrays.asList(new TreeItem("B1"), new TreeItem("B2"), new TreeItem("B3"))
        );
        root.getChildren().addAll(Arrays.asList(packageA, packageB));
        return root;
      }
    
      private class ClickableTreeCell extends TreeCell {
        ClickableTreeCell() {
          setOnMouseClicked(new EventHandler() {
            @Override
            public void handle(MouseEvent event) {
              // Handle double-clicks on non-empty cells:
              if (event.getClickCount()==2 && ! isEmpty()) {
                System.out.println("Mouse double-clicked on: " + getItem());
              }
            }
          });
        }
    
        @Override
        protected void updateItem(String item, boolean empty) {
          super.updateItem(item, empty);
          if (empty) {
            setText(null);
          } else {
            setText(item);
          }
        }
      }
    }
    
  • a few seconds "turn on", how can make I make in the structure of the event

    Hi, friends of LabVIEW

    I want to leave user click and hold down a button for a few seconds to turn on a device. Using registry item and history of shift I can make it work. I wonder how to implement it with case and structured event. Which case should I choose? mouse up?

    I have attached the test code as well.

    Thank you.

    I'm sure there are a lot of possible solutions, but here's a way to do it with a structure of the event. Mechanical action of the button is "Switch release." Pressing the button disables the output and sets the timeout of the event at certain time structure. The timeout event switches the output to true. Any other event resets the timeout to-1 value. Unfortunately, it seems that the tool gets messed up the image, so the VI is thus established.

  • Combine events "Key Down" and "ValueChange?

    Hello

    I have a string control box where a bar code is entered. I want to discover two events that should trigger the same action:

    Event 1: Loss of Focus (= change value)

    For example, someone focuses on the channel control unit and changes a number, and then puts the focus (without pressing). At the time where the focus is more, this event is raised.

    Case 2: Enter"" key.

    In any time you press the key "enter" in the area of control of chain. I can filter Vcle to check whether or not it is the "enter" key. For example, a user could bring out the code bar and press ENTER to specify the barcode must remain unchanged.

    My problem is, I need to trigger the two events, but only once.

    If I have two events separate case, 2 event will raise also 1 event, so my action will be spooled twice. Not good.

    I'm not yet sure how to combine two cases of event in a unique event, which triggers only once on 'enter keypress' or "lost focus, change the alias value". Any suggestions?

    See below. Thank you!

    Switch to dynamically registered events:

    Note that you must pass the dynamic events in the event sources list:

    Then, after each event, unregister and then register again for events.  If there was an event in the queue's duplicate, this will destroy it.

  • Digital button &amp; code that must run outside the switch of the event

    I have an interesting situation.  I have a command button which I activated the control via the mouse wheel of the user (thanks to great examples of code herein for one!). To do this I like, I had to put the processing part of the code outside the set event button, such that the value of the output of the control would be updated immediately.

    The only problem with this methodology which is then when the user closes the Panel and the button control is a final reminder, this block of code is executed one last time, which translates into a non fatal error "invalid control ID '.  The solution here is relevant, but is not ideal as shown above.

    My solution feels like a hack, but tell me what you think - trap on EVENT_DISCARD and back at the beginning.  Seems to work, just feels like a patch.  Here is the code:

    int CVICALLBACK KnobCallback(int panel, int control, int event, void *callbackData, int eventData1, int eventData2)
    {
        int prevValue = 0;
        int currValue;          // current value of knob control, range = 0-100
        double currMotor = 0;
        double currMeter = 0;
        double idealMotor = 0;
        double currVoltage;
        int max, min, inc;
    
        // find the range values set in the UIR control:
        GetCtrlAttribute(panel, control, ATTR_MIN_VALUE, &min);
        GetCtrlAttribute(panel, control, ATTR_MAX_VALUE, &max);
        GetCtrlAttribute(panel, control, ATTR_INCR_VALUE, &inc);
    
        // load the current control changed value:
        GetCtrlVal(panel, control, &currValue);
    
        switch (event)
        {
            case EVENT_COMMIT:  // any control commit:
                break;
    
            case EVENT_MOUSE_WHEEL_SCROLL:
    
                switch (eventData1)
                {
                    case MOUSE_WHEEL_SCROLL_UP:
                        if (currValue < max)
                            currValue += inc;  // increment 1 step at a time, not eventData2 number of steps (Windows scroll wheel number)
                        else
                        {
                            currValue = max;    // hold at max
                            return 1;   // Swallow event to prevent from updating UIR
                        }
                        break;
    
                    case MOUSE_WHEEL_SCROLL_DOWN:
                        if (currValue > min)
                            currValue -= inc;  // decrement 1 step at a time, not eventData2 number of steps (Windows scroll wheel number)
                        else
                        {
                            currValue = min;    // hold at min
                            return 1;   // Swallow event to prevent from updating UIR
                        }
                        break;
    
                    case MOUSE_WHEEL_PAGE_UP:
                        if (currValue < max)
                            currValue += (inc * 5);  // eventData2 = 0 when PAGE up/down
                        else
                        {
                            currValue = max;    // hold at max
                            return 1;   // Swallow event to prevent from updating UIR
                        }
                        break;
    
                    case MOUSE_WHEEL_PAGE_DOWN:
                        if (currValue > min)
                            currValue -= (inc * 5);  // eventData2 = 0 when PAGE up/down
                        else
                        {
                            currValue = min;    // hold at min
                            return 1;   // Swallow event to prevent from updating UIR
                        }
                        break;
                }
                SetCtrlVal(panel, control, currValue);  // update control with processed value
                break;
    
            case EVENT_VAL_CHANGED:
                if ((currValue < prevValue) && (currValue > min))         // decrementing above floor
                {
                    currValue -= inc;
                }
                else if ((currValue > prevValue) && (currValue < max))        // incrementing below ceiling
                {
                    currValue += inc;
                }
                else if (currValue = max) // TODO: this condition doesn't work as expected; control doesn't trap for wrap-around from max to min, vice versa
                {
                    currValue = max;    // hold at max
                    return 1;   // Swallow event to prevent from updating UIR
                }
                else if (currValue = min) // TODO: this condition doesn't work as expected; control doesn't trap for wrap-around from max to min, vice versa
                {
                    currValue = min;    // hold at min
                    return 1;   // Swallow event to prevent from updating UIR
                }
                SetCtrlVal(panel, control, currValue);  // update control with processed value
                prevValue = currValue;  // update state variable
                break;
    
            case EVENT_DISCARD:
                return 0;   // TODO: bug fix for quitting cleanly, so that the code outside of the event switch doesn't execute one last time when the panel is quit.
                break;
    
        }   // end switch
    
        currVoltage =  (currValue * MOTOR_VOLT_STEP) + MOTOR_VOLT_MIN;
        currMotor = LabJackTimer(LABJACK_TIMER0);
        idealMotor = MOTOR_SLOPE * currVoltage;
    
        if (abs((int)(currMotor - idealMotor)) < MOTOR_TOL)
        {
            SetCtrlVal(panel, MAINPANEL_TEXTMSG6, "GOOD");
            SetCtrlAttribute(panel, MAINPANEL_TEXTMSG6, ATTR_TEXT_BGCOLOR, VAL_GREEN);
        }
        else
        {
            SetCtrlVal(panel,MAINPANEL_TEXTMSG6,"FAIL");
            SetCtrlAttribute(panel, MAINPANEL_TEXTMSG6, ATTR_TEXT_BGCOLOR, VAL_RED);
        }
        return 0;
    }
    

    I suggest to put the code SetCtrlVal fragment in a separate function and call this function for the correct event only; at present, it is called for any event, including the event throwing...

    In addition, there is no need to recall the values min/max/inc of your control each time, once the start programme should be enough

  • Mouse down? Event rejection does not

    Dear community,

    Please could you help me to work the reasons why the mouse down? Event is not be thrown in the following code. I deleted all but the relevant controls. It must be that clicking a control with the left middle of the mouse or buttons right mouse returns the name and the control key, it has been activated with (which it does), but NOT when the Boolean lock is True.

    However, he seems to ignore the value of the Boolean lock?

    Please help me understand what I did wrong here.

    Many thanks in advance,

    R Gibbs

    In the event of filter actions are performed without worrying.  If you add another case of "Change value" or "Mouse Down" for all these buttons, it will not be triggered when the lock is set to TRUE.

  • Validation of required field only when the page loads (HR test case!) included

    Hi experts,


    Here you have a simple test for Jdev 12.1.3 HR case: https://dl.dropboxusercontent.com/u/18609389/TestHR.zip

    The main.jspx is just a button which CreateInsert a record dept displayed in another page:

    Screen Shot 10-16-14 at 07.04 PM.PNG

    My problem is the following page (test.jspx) has this code to run when the page loads:

    <af:serverListener type="onloadEvent" method="#{backingBeanScope.backinBean.onPageLoad}"/>
                <af:clientListener method="onLoadClient" type="load"/>
                <af:resource type="javascript">
                  function onLoadClient(event) {
                      AdfCustomEvent.queue(event.getSource(), "onloadEvent", 
                      {
                      },
    false);
                      return true;
                  }
                </af:resource>
    

    The code is simply this (now):

        public void onPageLoad(ClientEvent clientEvent) {
            logger.severe("HR TEST.....");
        }
    

    And that's the problem, required validation is performed.

    Screen Shot 10-16-14 at 07.06 PM.PNG

    Can you tell me why?

    Thank you

    Jose.

    Don't know what is my mistake, but the code is of the actionListener button is not called. :-(

    Well, you combined two different ways to do this (from my first answer).

    If you are still reading this, you will notice "or" before the second suggestion

    Thus,.

    1. keep your clientListener under af:document tag

    2. based on javascript, you find key (use: alert ("button");)  to see if you have referenced correctly your button in findComponentById())

    And then:

    approach 1:

    Use AdfActionEvent.queue (button, true);  queue event on your action button and implement your logic in function attached to the properties of your 'actionListener' or 'action' button (if you don't need listener server in this case)

    approach 2:

    Use AdfCustomEvent.queue (button, "onloadEvent", {}, false);  the queue onloadEvent on your button (in this case you need listener server attached to your button)

    Dario

Maybe you are looking for

  • Mac does not recognize an external HD

    So let's see if I can explain this, I bought a pc and I want to transfer my files via via external hard drive I went to the utility thing disk partition and it came back with an error, so I ended up hitting erase the drive. Now I can transfer files o

  • Call from someone claiming to be form Microsoft wanting to access my computer

    Received a call from 1-800-786-0425 saying they were Microsoft and requesting access to my computer.  Indian accent, had large echo phone and not clear.  Search for Microsoft and I noticed that a number of 1-866-769-4258 using Microsoft Canada got an

  • HP 7520 itself begins to turn

    My HP 7520 itself begins to turn. I don't know why or how. It tries to access the internet and download updates? If so, how can I disable this feature? Thanks in advance...

  • Black cartridge C410a does not

    Installed all new cartridges, ran the alignment, clean the nozzles several times, sitting and reinstall the black cartridge. Ink level on the screen of the printer displays full cartridge but the solution (on PC) Center shows no graphic content. Seve

  • Hidden or missing files & folders

    After the remote session of 6 hours with McAfee (problem still not fixed) disappearance of several files & folders 'Documents '. Try to replace in hard drive backup and says Windows files still exist, but I do of course see them. Any help?