Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
I need to define and raise a custom event
Message
De
04/05/2001 11:30:41
Gerry Schmitz
GHS Automation Inc.
Calgary, Alberta, Canada
 
 
À
03/05/2001 21:01:10
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Divers
Thread ID:
00503314
Message ID:
00503547
Vues:
20
>I was wondering... Is there any way to define and raise a custom event in VFP ?
>If you found the answer, please let me know. I need it desperately !

What's the "trigger" for this event ?

Normally, you can't create "custom events" in VFP. However, in some situations, I have generated some obscure key code (ie. something > CHR(200)) and then responded to it in .Keypress(); it then "seemed" like a custom event.

There's also the old READ EVENTS "loop".

If your mainline is build around a ...
DO WHILE lQuit = .F.
   READ EVENTS
ENDDO
... then you can have a "case" within the DO loop that tests a "message queue" for any pending events prior to doing the READ EVENTS. Any time you need to handle a particular event, you stuff the info into the "message queue" and do a CLEAR EVENTS. The "case" handles the events until the queue is "empty"; eg.
DO WHILE lQuit = .F.
   DO CASE
   CASE cEvent = "Report"
      ...
   CASE cEvent = "New Form"
      ...
   OTHERWISE
      READ EVENTS
   ENDCASE
ENDDO
It's "sort of" the way Windows does "messaging" internally.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform