Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DOEVENTS()
Message
From
15/02/2001 12:52:22
 
 
To
15/02/2001 07:00:41
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00476198
Message ID:
00476364
Views:
24
>Hi,
> I would like to allow user to cancel a long process by clicking a "Cancel" button. I tried to use "Fast doevents" in my code as the following:
>
>
>SELECT mytable
>
>SCAN
>   **DO WATEVER
>   IF MDOWN()
>     DOEVENTS()
>   ENDIF
>ENDSCAN
>
>
>
>I found that, MDOWN() return .T. once I click on my "Cancel" button. However, my code in cancel button.CLICK() is not fired. Any ideas?
>
>Thank you

I'm not sure why your button click isn't being fired, but maybe because it's DOEVENTS not DOEVENTS(), it's not a function, it's a command.

But here's some code that should work
LOCAL obtn, ncnt, x
obtn = thisform.StopButton
ncnt = 0
DO WHILE .t.
  *
  * Your processing code here
  *
  x = SYS(1270)
  IF MDOWN() AND TYPE('x')='O'AND obtn.Name=x.Name
    thisform.stopme = .t.
*    DOEVENTS         && Note that DOEVENTS is not even needed!
  ENDIF
  IF thisform.stopme
    EXIT
  ENDIF
  ncnt = ncnt + 1
  WAIT WINDOW NOWAIT 'Run Away '+TRANSFORM(ncnt,'')+'!!!!!'
ENDDO
STORE .NULL. TO x, obtn
Fred
Microsoft Visual FoxPro MVP

foxcentral.net
Previous
Reply
Map
View

Click here to load this message in the networking platform