Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
DOEVENTS()
Message
De
15/02/2001 12:52:22
 
 
À
15/02/2001 07:00:41
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00476198
Message ID:
00476364
Vues:
23
>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform