To exit from the while(1) loop

Hi all ,
I have a simple question that if in a callback function of a command button, i use a While(bLoop)
loop , where bLoop is a boolean variable initially set to TRUE, then how can i break or exit from this while Loop by using a control on the front panel  , which exits the while loop by setting     bLoop = FALSE .
I have tried it but it is not exiting  
Solved!
Go to Solution.

The problem here is that CVI normally only executes one callback at a time. While you are in one control callback, no GUI processing and subsequent calls to other callbacks normally occurs.
You can try the following approach - but it is not really the best method:
    while (b_loop) {              // Inside a callback
        ...                       // Perform your tight program loop
        ProcessSystemEvents ();   // Force CVI to see if any GUI controls need servicing
If you have a different control callback to clear the global b_loop, this quick-and-dirty approach might work for you.
You should only use this technique for very simple programs - it can rapidly spiral out of control and end up in a mess if you're not careful. NI recommends that you do not use ProcessSystemEvents() inside a control callback.
JR

Similar Messages

  • Can`t exit from the app corner mode in windows phone 10 technical preview at Nokia Lumia 520

    After upgrading to windows phone 10, I just face several bugs as expected, including screen unlock bug. I just try app corner feature on my phone. That`s led to a big mistake. I can`t exit from the app corner mode. While pressing the power off
    button and swap right, nothing happens. (In lock screen, it doesn`t show that swap right to exist. I think this problem also related to locks screen bug.  Even I try  to remove the battery. But, still I struck at app corner. Please
    help me come out this problem!!!
    Thanks in advance
    Mohamed Usman
    www.neotech4u.weebly.com

    Very very disappointed. Sorry about windows phone. I have argued quit a lot with friends. Trying to convince them that WP are extremely good and nice to work with. Unfortunately they keep telling me about the poor apps of WP. Unfortunately I can now start seeing the problem. Guess what, I wasconsidering of buying my father a WP. Guess what. I will probably stick to android. Badly played about that. Farewell. Disappointed 7.8 WP customer from Athens Greece.

  • How to exit from the button test in diagnostic mode

    Hi,
    I am having some trouble with my ipod 7th gen.
    First my lightning cable wont be recognize. show the error Accesory incompatible.
    I try to solve the problem cleaning the golden pins in the cable and in the ipod. Don't work
    I enter in diagnostic mode in my ipod and I get stucked in the button counter test..
    In the screen appear a mesage 'Please reset the unit to end'. I don't know how to reset the unit
    I press any button and only increase the counter for every button.
    First how acan exit from the button counter test and how can fix the issue with the lightning cable

    Your problem is that you are trapped inside an event case. It is not a good idea to run extended code inside event cases, else the event structure cannot service other events.
    Why don't you use the outer loop for everything? Now things don't step on each others toes. What good is an event structure if it cannot react at all times???
    Message Edited by altenbach on 07-25-2008 12:26 AM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    event_problemMOD.vi ‏17 KB

  • How to track exit from the PageFragment Lifecycle

    Hi,
    I have a requirement of keeping track of exit from a pageFragment.
    My structure contains: a TaskFlow which contains a train . This train node contains the page Fragments. Now when i navigate from one PageFrag to another ie. when i exit the currently selected node having a page Fragment, i need to fire a logic.
    I tried using creating a bean which implements RegionController interface which has refreshRegion(RegionContext ) method.I got hold of RegionBinding interface which has only one of the following values: Entry, Execute_Model, Prepare_Model, Refresh_Unknown, Render_Model and Type_executable_region.
    Also in this case i am not exiting the TaskFlow during the navigation.
    My doubt is how do i or can i use RegionController to keep track of exit from the currently rendered PageFragment's  Lifecycle.
    Also , can i use PagePhaseListener to keep track of the PageFragment lifecycle stage. (My understanding is PagePhaseListener is to be used for Jspx not Jsff). Plz do correct me if i am wrong.
    Thanks,
    Prasenjit
    Edited by: user586616 on Aug 31, 2009 3:54 AM
    Edited by: user586616 on Aug 31, 2009 3:57 AM

    Hi Frank,
    I have created a ControllerClass which implements RegionController. I have registered the same as controller class in my pageFragments PageDef.
    So, on navigation from one train node to another. due to post back call to leaving node and freshcall to the arriving node in the train flow. i am able to get the leaving as well approaching node.
    My doubt is can i get similar or better control over the nodes traversed using trainModel or anyother adfinternal controller class? Kindly suggest any better way of getting handle to the navigating train nodes.
    Sample Code which i have implemented:
    public class RegionControllerBean implements RegionController {
    public boolean refreshRegion(RegionContext regionContext) {
    System.out.println("**********************************");
    System.out.println("inside refreshRegion method call");
    String selectedView = ControllerContext.getInstance().getCurrentViewPort().getViewId(); ------> this gives me the handle to the viewId of the curently selected pageFragment
    System.out.println(ControllerContext.getInstance().getCurrentViewPort().getViewId().toString());
    String pageName = selectedView.split("/")[2];
    System.out.println("Current PageName:"+pageName);
    System.out.println("name: "+regionContext.getRegionBinding().getName());
    int refreshFlag = regionContext.getRefreshFlag();
    if(refreshFlag == RegionBinding.PREPARE_MODEL){
    System.out.println("Inside prepare Model phase"); ------> on entering of that node i need to call some logic before prepare_model phase
    if(refreshFlag == RegionBinding.EXECUTE_MODEL){
    System.out.println("Inside execute model phase");
    if(refreshFlag == RegionBinding.RENDER_MODEL){
    System.out.println("Inside render model phase");
    // propagate refresh to inner binding container
    regionContext.getRegionBinding().refresh(refreshFlag);
    return false;
    public boolean validateRegion(RegionContext regionContext) {
    // propagate the validate to inner binding container
    System.out.println("inside validate region method");
    regionContext.getRegionBinding().validate();
    return false;
    thanks,
    Prasenjit

  • Regarding exit from the module pool screen

    h experts,
    i have developed a module pool report in which in the selection screen i have four fields which are mandatory ,when i execute the program without entering in the selection screen it do not allow to come out of the module pool screen ...what i want that without entering any input in the selection screen if i press exit button push button it will allow to come out of the screen for this what sud i do plz help me....

    Hi
    keep a button called <b>EXIT</b> on the screen
    Make the function type of that field as <b>E</b>
    in Flow logic write
    PROCESS AFTER INPUT.
    Forced Exit from the transaction from screen
      MODULE exit AT EXIT-COMMAND.
    double click on exit module and
    then in PAI write
    *&      Module  exit  INPUT
    Exit from the Transaction
    MODULE exit INPUT.
      CASE okcode.
        WHEN 'EXIT' OR 'CANCEL'.
          CLEAR okcode.
          LEAVE PROGRAM.
      ENDCASE.
    ENDMODULE.                 " exit  INPUT
    <b>Reward points for useful Answers</b>
    Regards
    Anji

  • Accessing the Logon User Exit from the Internet using an ITS Service

    I can access the Logon User Exit (EXIT_SAPLSUSF_001) from R/3, but not from the Web using an ITS service. What am I missing in order to access the Logon User Exit from the Web. The ITS service was created from an ABAP screen program.
    Thanks
    david yee

    The SAPGui logon exit is called after successfull authentication has been completed and after a SAPGui session has been attached.
    If you logon via RFC, WebGui, ICM or the Wgate then this exit does not trigger.
    What are you wanting to add to your code after the logon ?
    An solution I have used is to create a wrapper RFC for a BAPI and create a webservice for the wrapper. Before calling the BAPI you can do whatever you want to from a security perspective.
    But for that you need to have an appropriate BAPI...
    Please explain what you want to do and what you would have wanted in the exit. Often there is a better way.
    Cheers,
    Julius
    ps: I moved this to the security forum.

  • How to exit from the class execution process?

    I am invoking an exe from my Java application using the Runtime.getRuntime().exec() method.
    though the process is completed, the class is still running.
    how do i exit from the class execution, but with the process still running??

    To sabre150 :
    I am directly executing the command through the exec() method:
    Runtime.getRuntime().exec("...../iexplore.exe");This way, the control is going to the opened IE window and only on closing it, my class is exiting.
    Is there any other way where I can come out of the class, but ensure that the process which i run through the exec() method, is still running?

  • Portal logoff should Close or Exit from  the window

    Hi Friends,
    Please help me here, When user click on logoff or Exit from the portal the Window should be closed. (I disabled the popup message box , now I am trying to figured it out how to close the window)
    Please help me.
    Peter

    Hi Peter,
    If you try to write JavaScript  in par file to close window, i think portal will not properly logoff from portal.
    Better to create a seperate html page which contain script to close the window on load. Also include script to remove cookies created by portal (not mandatory). Save the html page in server..
    You can redirect portal after logoff to this page by setting ume logoff url in visual administrator.
    We implemented this in portal and working fine in IE. For Firefox it will prompt a message, since it will not allow close window from script due to security reasons.
    If you need html code and script let me know i will send it.
    Regards
    Baby

  • Conditional Exit from the script

    Hi,
    I have to code the script like the below
    --Step 1
    begin
    If <Table1 doesnot exist> then
    Display "User Defined Error Message: Table1 doesnot exit"
    EXIT FROM THE SCRIPT(Below sql should not run)
    endif
    end
    --Step 2
    spool abc.txt;
    select "should not run" from Table1;
    spool off;Step 2 should not run if table1 doesnot exist.
    Can someone please tell how to conditionally exit the script.
    Thanks & Regards,C
    CDPrasad
    Edited by: cdprasad on Aug 12, 2010 1:35 PM
    Edited by: cdprasad on Aug 12, 2010 1:36 PM
    Edited by: cdprasad on Aug 12, 2010 1:38 PM
    Edited by: cdprasad on Aug 12, 2010 1:38 PM

    Hi,
    David is right; SQL*Plus is the wrong tool for this job.
    If you really want to to this in SQL*Plus, you can achieve a crude type of branching by using sub-sripts. Instead of an IF statement, you use START or @ to run one or another of those sub-scripts, based on a substitution variable, which in turn is set by a query.
    For example:
    --     abc.sql - Test if table1 exists, and
    --                     (1) if it exists, run abc_query.sql to do a query
    --                     (2) if it does not exist, run abc_error.sql to display an error message
    --     Preliminary query, to define next_script:
    COLUMN     next_script_col        NEW_VALUE next_script
    SELECT     CASE      COUNT (*)
             WHEN  0  THEN  'abc_error'
                       ELSE  'abc_query'
         END     AS next_script_col
    FROM     all_tables
    WHERE     table_name     = 'TABLE1'
    AND     owner          = 'SCOTT'
    --     Now that we know what to do, do it:
    @&next_scriptYou would run the above script (abc.sql) and it would decide whether to run the script containing you query, or the script that prints an error message.
    Why does table1 sometimes disappear? In a good database design, tables are permanent structures, and get dropped only when they are obsolete. Perhaps you should be TRUNCATing the table, not dropping it.

  • Can you help me EXIT  from the itunes store back to my play list?

    can you help me EXIT  from the itunes store back to my play list?

    If you're using iTunes 11, click on "Library" on the top right, then clck on "Playlists" on the top.

  • I am using the "Menu Selection With Events.vi" example alongside other while loops, When I select exit from the new menu it stops the other while loops but not the menu/event while loop

    The event driven menu example works fine and I've integrated it into my application. I have built in simple local vars to link menu selections to existing GUI buttons. The problem is that I cannot get the File-Exit menu option to switch off/terminate the application. The [1] "Stop": Value Change panel of the event structure simply switches off the other while loops but leaves the event while loop running. Add a while loop to the axample using a local var from the event while loop to terminate 2nd while loop to get the effect.
    Help appreciated, Chris

    Attached you will find a modified version of your VI.
    I documented what I did on the block diagram.You were right on you just needed to add a variable with a true wired to it.
    Have fun with it.
    Joe
    Joe.
    "NOTHING IS EVER EASY"
    Attachments:
    Menu_Selection_with_Events_%26_while_loop[1].vi ‏76 KB

  • Re: exit from a while loop in sub vi

    I think the mail didn`t get through first time. Repeat posting - Sorry if
    this occurs twice
    Shane
    Hallo,
    Can the use of occurrences solve this problem?
    The Main program can create an occurrence which can be passed to the
    sub-VIs. Upon pressing the button to cancel the loop, the occurrence can be
    set, instantly transmitted to all other VIs sharing which were passed the
    same occurrence. Of course a small handling routine has to be written (say
    a sequence parallel to the executing while loop waiting for the occurrence
    and then setting the exit parameter to "true") but this is trivial.
    I have checked this with a small program splitting an occurrence to three
    seperate VIs and it works.
    If you want, I can send a cop
    y of it.
    It may well be possible with notifiers or something else, but I have far
    less experience with them.
    Hope this helps
    Shane
    >pcu schrieb in Nachricht
    ><[email protected]>...
    >>Main vi has several sub-vi's. Each sub vi has a while loop and Boolean
    >>button. When program runs, sub-vi front panel appears, and I can
    >>stop/continue the while loop. But when I stopped a while loop in a
    >>sub-vi, I cannot control other while loops in other sub vi.
    >>I need exit function from a while loop, not stop function of entire
    >>program.
    >>Thanks.
    >
    >
    Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)

    The notifier is probably better than occurence at this case - than it is not neccessry to write a parallel sequence.
    The use of notifier is very simple, just follow an example in Help/Search example -> Advances -> Execution control -- Synchronization -> SubVI notification.
    Good luck
    Ferda

  • Exit from a while loop in sub vi

    Main vi has several sub-vi's. Each sub vi has a while loop and Boolean button. When program runs, sub-vi front panel appears, and I can stop/continue the while loop. But when I stopped a while loop in a sub-vi, I cannot control other while loops in other sub vi.
    I need exit function from a while loop, not stop function of entire program.
    Thanks.

    Hallo,
    Can the use of occurrences solve this problem?
    The Main program can create an occurrence which can be passed to the
    sub-VIs. Upon pressing the button to cancel the loop, the occurrence can be
    set, instantly transmitted to all other VIs sharing which were passed the
    same occurrence. Of course a small handling routine has to be written (say
    a sequence parallel to the executing while loop waiting for the occurrence
    and then setting the exit parameter to "true") but this is trivial.
    I have checked this with a small program splitting an occurrence to three
    seperate VIs and it works.
    If you want, I can send a copy of it.
    It may well be possible with notifiers or something else, but I have far
    less experience with them.
    Hope this helps
    Shane
    pcu schrieb in Nachr
    icht
    <[email protected]>...
    >Main vi has several sub-vi's. Each sub vi has a while loop and Boolean
    >button. When program runs, sub-vi front panel appears, and I can
    >stop/continue the while loop. But when I stopped a while loop in a
    >sub-vi, I cannot control other while loops in other sub vi.
    >I need exit function from a while loop, not stop function of entire
    >program.
    >Thanks.
    Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)

  • How to exit from the loop

    loop at itab.
    if <CONDITION>
    <EXIT LOOP>
    endif
    endloop.
    this ths condition , pz tel how to exit from loop

    Hi
    Loop
       statements
    EXIT
    Endloop.
    Will comes out of the loop.
    Regards,
    Sreeram Kumar.Madisetty

  • Solving a maze with 4 exits from the inside

    Hi, I'm working on an algorithm that solves a maze from the inside, and seeks out 1 of the 4 exits on the sides, and after getting 1, it goes to the next until it has them all. The maze is always 22x22, and you only have 400 steps. I asked my teacher about using a recursive method to solve it, and he said that is probably the best way to go. But, the catch is that you don't know where the walls are, and they change every time. The rat (I'm trying to get a rat to all four exits) starts in the 4x4 box in the middle that has between 1 and 5 exits (it's different every time a maze is generated). The rat can see how far away a wall is, and you are allowed to store the positions in an array if you wish. He can also build walls and get his current x and y position.
    Here's an example of what a maze looks like:
    http://farm4.static.flickr.com/3528/3201086335_4556d4aed7_o.jpg
    I think that's everything, any help would be greatly appreciated =]

    code continued...
        // recursivly find the best path-of-travel
        public int[] recursePath()
            // if in an exit, kill the recursion process
            if(x==0||x==21||y==0||y==21) {int[] bestPath = new int[1]; return bestPath; }
            // x- and y- counters are to signify how many units in each direction
            // from the current real x, y that the algorithm is at
            int curX = x+xCounter;
            int curY = y+yCounter;
            // the maximum number of moves = the closestExitRange, plus however
            // many fewer/extra moves are needed so it lands EXACTLY on the exit,
            // minus the number of places generated so far.
            moveCount = closestExitRange + neededExtraMoves - spacesMoved;
            // give the bestPath a length if it is the first time running algorithm
            if(spacesMoved==0) bestPath = new int[moveCount];
            while(spacesMoved<moveCount)
                // if the algorithm will not land in an exit in EXACTlLY
                // x number of moves, edit x acordingly, and reset algorithm.
                // if there are not enough moves to make it to the exit, crear variables,
                // add 1 to extra moves, check again.
                if( spacesMoved==moveCount-1 && ((curX>1 && curX<20) || (curY>1 && curY<20)) )
                    neededExtraMoves++;
                    xCounter=0;
                    yCounter=0;
                    spacesMoved=0;
                    bestPath = new int[moveCount];
                    recursePath();
                // if there are not too many moves, crear variables,
                // subtract 1 from extra moves, check again.
                else if( spacesMoved<moveCount && (curX==0 || curX==21 || curY==0 || curY==21) )
                    neededExtraMoves--;
                    xCounter=0;
                    yCounter=0;
                    spacesMoved=0;
                    bestPath = new int[moveCount];
                    recursePath();
                // look in all directions, and find the highest value, and
                // move in that direction
                int moveDir = findFurthestWay(lookNorth, lookEast, lookSouth, lookWest);
                if(moveDir==NORTH) { yCounter--; bestPath[spacesMoved] = NORTH; }
                if(moveDir==SOUTH) { yCounter++; bestPath[spacesMoved] = SOUTH; }
                if(moveDir==WEST)  { xCounter--; bestPath[spacesMoved] = WEST;  }
                if(moveDir==EAST)  { xCounter++; bestPath[spacesMoved] = EAST;  }
    //             curX = x+xCounter;
    //             curY = y+yCounter;
                spacesMoved++;
                recursePath();
            //bestPath = new int[moveCount];
            return bestPath;
        // find the path that has thegreatest line of sight (in order n, e, s, w)
        public int findFurthestWay(int a, int b, int c, int d)
            int greatestNumber = 0;
            if(a>greatestNumber) greatestNumber = a;
            if(b>greatestNumber) greatestNumber = b;
            if(c>greatestNumber) greatestNumber = c;
            if(d>greatestNumber) greatestNumber = d;
            // NORTH=1, EAST=2, SOUTH=3, WEST=4
            if(a==greatestNumber) return NORTH;
            if(b==greatestNumber) return EAST;
            if(c==greatestNumber) return SOUTH;
            if(d==greatestNumber) return WEST;
            return 0;
        // reset recursePath vars.
        public void resetCounters()
            xCounter = 0;
            yCounter = 0;
            spacesMoved = 0;
            neededExtraMoves = 0;
            moveCount = 0;
            bestPath = new int[moveCount];
        // record the positions of the walls
        public void storeWallLocations()
            // Store the locations of the walls
            if(lookNorth!=100) wallLocations[x][y-lookNorth][0]=true;
            try{wallLocations[x][y-lookNorth-1][2]=true;} catch(Exception e){}
            if(lookSouth!=100) wallLocations[x][y+lookSouth][2]=true;
            try{wallLocations[x][y+lookSouth+1][0]=true;} catch(Exception e){}
            if(lookWest!=100) wallLocations[x-lookWest][y][3]=true;
            try{wallLocations[x-lookWest-1][y][1]=true;}  catch(Exception e){}
            if(lookEast!=100) wallLocations[x+lookEast][y][1]=true;
            try{wallLocations[x+lookEast+1][y][3]=true;}  catch(Exception e){}
    }

Maybe you are looking for

  • IMPORT/EXPORT FROM DATA BUFFER

    Hi, I have some code like this: DATA: b type xstring. DATA: a type xstirng. EXPORT '1234' TO DATA BUFFER b. IMPORT a FROM DATA BUFFER b. for some reason a does not get set to the value that I assigned to b. However, this code works: DATA: b type xstr

  • My iphone is in recovery mode

    my iphone is in recovery mode

  • What is best basic video editing app for Mac

    I'm looking for a video editing application for the mac. I only require something basic, as in being able to crop out unwanted footage and join multiple movie files then export to MP4 format. I don't need to add audio, titiles or make colour adjustme

  • I have forgotten to save my friend's new phone.

    The call history has cleared yesterday. Luckily, I have backuped it. Can I get the number back?

  • Upgrade to 10.1.3.4

    we've upgraded from 10.1.3.3 to 10.1.3.4 during setup process we choose to keep the existing configuration instead of whole new setup. after installation the user privileges and access are missing or reset? ex: user had access to answers before upgra