problems with on escape

Tech-Archive recommends: Fix windows errors by optimizing your registry



I have the commands around a big loop:

ON ESCAPE DO SETCANCEL
SET ESCAPE ON
glcancel = .f.
DO WHILE !glcancel
...
IF glcancel
EXIT
ENDIF
ENDDO
SET ESCAPE OFF
ON ESCAPE
IF glcancel
... say some error message
ENDIF


When I press escape, sometimes it runs SETCANCEL correctly, but sometimes it
gives me the CIS dialog.

What could cause the 'on escape' from not executing.

The code in SETCANCEL.PRG:

IF SYSDIALOG("Cancel. Are You Sure") && MESSAGEBOX()
GLCANCEL = .T.
RETURN
ELSE
glcancel = .f.
RETRY
ENDIF



Thanks


.



Relevant Pages

  • Re: problems with on escape
    ... VFP may not get the Escape keypress if Windows isn't given time to pass it along. ... You probably need to add a DOEVENTS in the loop. ... DO WHILE!glcancel ... SET ESCAPE OFF ...
    (microsoft.public.fox.helpwanted)
  • Re: loop never exits on ESC
    ... You've placed the ON ESCAPE within the loop. ... It functions much like the ON KEY LABEL. ... > ENDIF ... > * if no further slots, exit ...
    (microsoft.public.fox.programmer.exchange)
  • Re: loop never exits on ESC
    ... > I tried ur code but have not got any wait window when i pressed ESC :-( ... >> WINDOW for about .5 second each time you press escape. ... >>>>> ENDIF ...
    (microsoft.public.fox.programmer.exchange)
  • Re: SET ESCAPE and ON KEY LABEL ESC
    ... the only way to make OKL behave is to have SET ... If you have SET ESCAPE ON then fp will check between each sourceline ... if a key is pressed; if SET ESCAPE OFF ... >ON KEY LABEL esc. ...
    (microsoft.public.fox.programmer.exchange)
  • Re: loop never exits on ESC
    ... > You've placed the ON ESCAPE within the loop. ... >> ENDIF ... >> EXIT ...
    (microsoft.public.fox.programmer.exchange)