Beak a loop with ALERTed key - Clarion

This is a discussion on Beak a loop with ALERTed key - Clarion ; Hi out there, I need to BREAK a LOOP that runs in a routine with one keystroke (e.g. F9Key); the routine is called by a control event (button OK accepted). Tried all kinds of things but nothing worked properly although ...

+ Reply to Thread
Results 1 to 3 of 3

Beak a loop with ALERTed key

  1. Default Beak a loop with ALERTed key

    Hi out there,

    I need to BREAK a LOOP that runs in a routine with one keystroke (e.g.
    F9Key); the routine is called by a control event (button OK accepted).
    Tried all kinds of things but nothing worked properly although the
    F9Key is "alerted" and recognised but unfortunately only when the loop
    has ended.

    Code sample:

    CASE ACCEPTED()
    OF ?OkButton

    i# = 0
    loop while i# < 1000000
    i# += 1
    if keycode() = F9Key then break.
    end

    END

    Does anyone have an idea how a keyboard entry (except: alt+ctrl+del)
    can be used to BREAK this loop?

    Thomas

  2. Default Re: Beak a loop with ALERTed key

    declare a variable:

    i LONG(0)

    Then use the code un the aproppiate embeds (NOTE: you would need to
    declare the EVENT:TIMER on the ELSE clause of the window event
    handling embed) Code:

    ACCEPT
    CASE EVENT()
    OF EVENT:ALERTKEY
    IF KEYCODE() = F9Key THEN !If user press F9
    TARGET{PROP:TIMER} = 0 !Shut down timer
    END
    OF EVENT:TIMER
    IF i < 1000000 THEN !Stop LOOP WHILE i < 1000000
    i += 1 !Increment i
    ELSE
    TARGET{PROP:TIMER} = 0 !Shut Down Timer
    END

    END
    CASE ACCEPTED()
    OF ?OkButton
    i = 0
    TARGET{PROP:TIMER} = 1 !Begin Timer (Processing Loop)
    END
    END


    ktw-x@t-online.de (ktw) wrote in message news:<7f696cbc.0407150443.65f64f4b@posting.google.com>...
    > Hi out there,
    >
    > I need to BREAK a LOOP that runs in a routine with one keystroke (e.g.
    > F9Key); the routine is called by a control event (button OK accepted).
    > Tried all kinds of things but nothing worked properly although the
    > F9Key is "alerted" and recognised but unfortunately only when the loop
    > has ended.
    >
    > Code sample:
    >
    > CASE ACCEPTED()
    > OF ?OkButton
    >
    > i# = 0
    > loop while i# < 1000000
    > i# += 1
    > if keycode() = F9Key then break.
    > end
    >
    > END
    >
    > Does anyone have an idea how a keyboard entry (except: alt+ctrl+del)
    > can be used to BREAK this loop?
    >
    > Thomas


  3. Default Re: Beak a loop with ALERTed key

    hilario@sistemasfw.com (Hilario Perez) wrote in message news:<e7fd3193.0407151329.1961ec7e@posting.google.com>...
    > declare a variable:
    >
    > i LONG(0)
    >
    > Then use the code un the aproppiate embeds (NOTE: you would need to
    > declare the EVENT:TIMER on the ELSE clause of the window event
    > handling embed) Code:
    >
    > ACCEPT
    > CASE EVENT()
    > OF EVENT:ALERTKEY
    > IF KEYCODE() = F9Key THEN !If user press F9
    > TARGET{PROP:TIMER} = 0 !Shut down timer
    > END
    > OF EVENT:TIMER
    > IF i < 1000000 THEN !Stop LOOP WHILE i < 1000000
    > i += 1 !Increment i
    > ELSE
    > TARGET{PROP:TIMER} = 0 !Shut Down Timer
    > END
    >
    > END
    > CASE ACCEPTED()
    > OF ?OkButton
    > i = 0
    > TARGET{PROP:TIMER} = 1 !Begin Timer (Processing Loop)
    > END
    > END
    >
    >
    > ktw-x@t-online.de (ktw) wrote in message news:<7f696cbc.0407150443.65f64f4b@posting.google.com>...
    > > Hi out there,
    > >
    > > I need to BREAK a LOOP that runs in a routine with one keystroke (e.g.
    > > F9Key); the routine is called by a control event (button OK accepted).
    > > Tried all kinds of things but nothing worked properly although the
    > > F9Key is "alerted" and recognised but unfortunately only when the loop
    > > has ended.
    > >
    > > Code sample:
    > >
    > > CASE ACCEPTED()
    > > OF ?OkButton
    > >
    > > i# = 0
    > > loop while i# < 1000000
    > > i# += 1
    > > if keycode() = F9Key then break.
    > > end
    > >
    > > END
    > >
    > > Does anyone have an idea how a keyboard entry (except: alt+ctrl+del)
    > > can be used to BREAK this loop?
    > >
    > > Thomas


    Thanks, that works fine for loop variable limits that are smaller than
    a few thousands since the loop variable is incremented by the timer.
    But what if the loop variable limit is a few millions?

+ Reply to Thread

Similar Threads

  1. Method to stop the For loop in the middle of exection of For loop
    By Application Development in forum labview
    Replies: 0
    Last Post: 12-17-2007, 03:40 AM
  2. Replies: 0
    Last Post: 09-20-2007, 06:40 PM
  3. stop while loop when for loop finished
    By Application Development in forum labview
    Replies: 4
    Last Post: 08-09-2007, 03:10 PM
  4. Re: While Loop and For Loop dont stop executing
    By Application Development in forum labview
    Replies: 0
    Last Post: 07-30-2007, 11:40 AM
  5. Re: While Loop and For Loop dont stop executing
    By Application Development in forum labview
    Replies: 1
    Last Post: 07-27-2007, 02:10 PM