Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Interrupting SCAN / ENDSCAN
Message
From
01/05/2006 17:29:45
 
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01118177
Message ID:
01118204
Views:
34
>No, I don't have any CLEAR KEYBOARD in my code. Thank you.
>
>>Just a SWAG........which could be WAY off........
>>
>>Does myProc have a CLEAR KEYBOARD, or anything that reads keystrokes so that the ESCAPE has already been processed by the time you hit the DOEVENTS????
>>
>>>I have a long process that goes between SCAN and ENDSCAN of a cursor. The process goes in a click() method of a button. I placed the following code in the procedure:
>>>
>>>
>>>set escape on
>>>lStop = .F.
>>>on escape lStop = .T.
>>>select MyCursor
>>>scan
>>>    DO MyProc()
>>>    doevents
>>>    if lStop
>>>       =messagebox("Cancel procedure",36,"Cancel?") = 7
>>>       exit
>>>    endif
>>>endscan
>>>
>>>
>>>But the =messagebox() never sees the action. What do you suggest?
>>>
>>>Thank you.

In general, the code you have should work. I don't like structures like EXIT and LOOP, so taking Naomi's advice I'd convert it to something like
set escape on
lStop = .F.
on escape lStop = ( messagebox("Cancel procedure",36,"Cancel?") = 7 )
select MyCursor
scan WHILE NOT lStop
    DO MyProc()
    doevents  && Should be optional
endscan
As for why it's not working, have you traced your code? Is it possible MyProc() does not exit (i.e. infinite loop)? Are there any rows in MyCursor (e.g. is it filtered so there are none)? Is the code somewhere in a subclassed ActiveX? In a case like this tracing/debugging should point out pretty quickly where the problem lies.
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform