Can't stop the loop!!! 
Author Message
 Can't stop the loop!!!

Hi everybody,

  So far, I didn't have any problem with enabling users to stop a "loop"
process by striking any key.  Here's the code I'm using:

                SET(MYFILE)
                LOOP
                  IF KEYBOARD()
                    IF ARRET_TRAIT('VOULEZ-VOUS VRAIMENT ARRTER?')
                      STOP_PROC# = TRUE
                      BREAK
                    END
                  END

                  NEXT(MYFILE)
                  ...

        This morning, I used that coding in a new program made with Clarion5
and it seems that the keyboard function can't read any keystroke.
During the loop, I just kept striking all keys and it was even possible
to hear that little beep sometime telling me that keyboard buffer was
full if not going sick!  But, Keyboard() function still can't read
anything...  I have a Penthium 200MMX with Windows 95 and Clarion5. Does
anyone have a hint on this?  

Thanks for your help,

Stphane Beauchemin
Mont St-Hilaire, Qc



Wed, 15 Aug 2001 03:00:00 GMT  
 Can't stop the loop!!!

Would this work?

Quote:
>            SET(MYFILE)
>            ACCEPT <============================= !!
>              IF KEYBOARD()
>                IF ARRET_TRAIT('VOULEZ-VOUS VRAIMENT ARRTER?')
>                  STOP_PROC# = TRUE
>                  BREAK
>                END
>              END

>              NEXT(MYFILE)
>              ...



Wed, 15 Aug 2001 03:00:00 GMT  
 Can't stop the loop!!!
Hi Stpane,

On Sat, 27 Feb 1999 01:41:54 -0500, =?iso-8859-1?Q?St=E9phane?=

Quote:

>During the loop, I just kept striking all keys and it was even possible
>to hear that little beep sometime telling me that keyboard buffer was
>full if not going sick!  But, Keyboard() function still can't read
>anything...  I have a Penthium 200MMX with Windows 95 and Clarion5. Does
>anyone have a hint on this?  

Keyboard isn't processed in a tight loop under windows.  You must use
a timer loop to be able to detect keyboard or any other events.  The
keyboard buffer simply fills up but nothing get's into your loop.
There are articles about timer loops in IKB and I'm sure also in
Steve's KB.

Best regards,

Arnor Baldvinsson        
[Team Topspeed - Internet Connect]
Allerup Edb
Denmark

Check out Icetips and Icetips Knowledgebase
http://www.icetips.com
UIN nr.: 2428601



Wed, 15 Aug 2001 03:00:00 GMT  
 Can't stop the loop!!!
Hi Martin,

  Thanks for your suggestion.  I'm not sure.  Didn't think of using
ACCEPT inside loop but will definitely try.  If any comments from
anybody, you are still welcome!

Thanks again,

Stphane

Quote:


> Would this work?

> >               SET(MYFILE)
> >               ACCEPT <============================= !!
> >                 IF KEYBOARD()
> >                   IF ARRET_TRAIT('VOULEZ-VOUS VRAIMENT ARRTER?')
> >                     STOP_PROC# = TRUE
> >                     BREAK
> >                   END
> >                 END

> >                 NEXT(MYFILE)
> >                 ...



Wed, 15 Aug 2001 03:00:00 GMT  
 Can't stop the loop!!!
Same happened to me when moving to CW5  ,  i havent been able to do this
yes even though i have had a few hints on how to so please inform if you
come up with a solutin

        Elli

P.s it is ridiculous that this is all of a sudden a problem , but there
are a few problems that are surfacing in CW5 , and some very serious.


Quote:
> Hi everybody,

>   So far, I didn't have any problem with enabling users to stop a "loop"
> process by striking any key.  Here's the code I'm using:



Wed, 15 Aug 2001 03:00:00 GMT  
 Can't stop the loop!!!
Hi Elli,

  Finally succeeded with using ACCEPT loop like suggested.  Works like a
charm!  Here is a sample of what I did:

    WINDOW{PROP:TIMER} = 1   ! Activer timer event 1/100 SECONDE

    CLEAR(OMF:RECORD)
    SET(ODBC_MASTERF)
    ACCEPT
      CASE KEYCODE()
      OF EscKey

        WINDOW{PROP:TIMER} = 0  !Dsactiver timer event

        IF ARRET_TRAIT('Dsirez-vous arrter le processus
d''importation?')
          FIN_IMPORT# = TRUE
          GOTO FIN_TRAIT
        ELSE
          WINDOW{PROP:TIMER} = 1   ! Ractiver timer event 1/100 SECONDE
          CYCLE
        END
      END

      CASE EVENT()
      OF EVENT:TIMER
        NEXT(ODBC_MASTERF)
        IF ERROR()
          BREAK
        END

        ! display information if required

        ! process information

      END
    END
  END

  WINDOW{PROP:TIMER} = 0

Finally, I'm sure it will solve your problem like it did for me.  If any
problem, just write me back!

Stphane

Quote:

> Same happened to me when moving to CW5  ,  i havent been able to do this
> yes even though i have had a few hints on how to so please inform if you
> come up with a solutin

>         Elli

> P.s it is ridiculous that this is all of a sudden a problem , but there
> are a few problems that are surfacing in CW5 , and some very serious.


> > Hi everybody,

> >   So far, I didn't have any problem with enabling users to stop a "loop"
> > process by striking any key.  Here's the code I'm using:



Wed, 15 Aug 2001 03:00:00 GMT  
 Can't stop the loop!!!
Hi Stephen,

  I didn't think this as being a bug but a change we had to live with
Clarion5.  BUT! If you think that the fact that keyboard() function
should be working like it used to be with Clarion 2.003 then this is
definitely a different story.  Can you comment on this?

Thanks in advance,

Stphane

Quote:

> There is a newsgroup for C5EE bugs and one for C5PE bugs on
> tsnews.clarion.com server.

> If you could post bugs there, it would be most helpful to the people at the
> Development Centre.

> Thanks
> Steve B.
> [Team Topspeed]


> >Same happened to me when moving to CW5  ,  i havent been able to do this
> >yes even though i have had a few hints on how to so please inform if you
> >come up with a solutin

> > Elli

> >P.s it is ridiculous that this is all of a sudden a problem , but there
> >are a few problems that are surfacing in CW5 , and some very serious.



Wed, 15 Aug 2001 03:00:00 GMT  
 Can't stop the loop!!!
There is a newsgroup for C5EE bugs and one for C5PE bugs on
tsnews.clarion.com server.

If you could post bugs there, it would be most helpful to the people at the
Development Centre.

Thanks
Steve B.
[Team Topspeed]

Quote:

>Same happened to me when moving to CW5  ,  i havent been able to do this
>yes even though i have had a few hints on how to so please inform if you
>come up with a solutin

> Elli

>P.s it is ridiculous that this is all of a sudden a problem , but there
>are a few problems that are surfacing in CW5 , and some very serious.



Thu, 16 Aug 2001 03:00:00 GMT  
 Can't stop the loop!!!
Hi Stphane,

On Sat, 27 Feb 1999 13:04:31 -0500, =?iso-8859-1?Q?St=E9phane?=

Quote:

>  Thanks for your answer.  I will certainly go and look for information
>in IKB as suggested.  BTW, Implementing timer loop, does it slow down
>processes using that kind of loop?  If so, is there any optimal
>combination?

There will be some slowdown.  It depends on how it's implemented.
Let's say you set the timer to 1 and on each timer you put this:

 Do MyProcess
 If KeyBoard() ! Or whatever you are using
   Loc:Done = True
 End

and have this routine

MyProcess  Routine
 Data
RecsPrCycle  Equate(100)

 Code
 If Not Loc:Done
   Loop RecsPrCycle Times
     Next(MyFile)
     If ErrorCode()
       Loc:Done = True
       Break
     End
     ! Do the file processing here
   End
 End

It all depends on the RecsPrCycle.  Make it small and you get slower
performance, but light on CPU, make it bigger and you get faster
performance, but heavy on CPU.  The smaller the number of records you
process pr. cycle the faster will the keyboard react - that is it will
be trapped soon after you press a key.  

Best regards,

Arnor Baldvinsson        
[Team Topspeed - Internet Connect]
Allerup Edb
Denmark

Check out Icetips and Icetips Knowledgebase
http://www.icetips.com
UIN nr.: 2428601



Thu, 16 Aug 2001 03:00:00 GMT  
 Can't stop the loop!!!
LOOP UNTIL KEYBOARD()  !Wait for any key
ASK
        IF KEYCODE() = EscKey THEN BREAK. !On esc key, break the loop
END

Out of the C5 on-line help. No indication that the Keyboard function  has
been (dare I say it<g>) Deprecated or modified so I'd say any change in
behaviour would be a bug (unless it behaves now in C5 as it did in CW1.0 in
which case CW2003 would be the regression).

Did I cover all bases<g>.

Steve B.
[Team Topspeed]

Quote:

>Hi Stephen,

>  I didn't think this as being a bug but a change we had to live with
>Clarion5.  BUT! If you think that the fact that keyboard() function
>should be working like it used to be with Clarion 2.003 then this is
>definitely a different story.  Can you comment on this?

>Thanks in advance,

>Stphane



Thu, 16 Aug 2001 03:00:00 GMT  
 
 [ 10 post ] 

 Relevant Pages 

1. Need to display sub-vi front panels without stopping WHILE loop containing those VI's

2. Using CGI module with 'canned queries'

3. nested while loops, inside loop not stopping correctly

4. It's not bad canned meat...

5. It's not bad canned meat...

6. It's not bad canned meat...

7. It's not bad canned meat...

8. STOP doesn't stop this procedure [TECHNICAL]

9. Seeking a LOOP macro that doesn't loop

10. Merging Tcl's event loop with some other event loop

11. Merging Tcl's event loop with other event loops (notifier)

12. How to stop AO in while loop

 

 
Powered by phpBB® Forum Software