Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
BINDEVENT() (and related) - best placement of code?
Message
De
24/04/2003 16:30:00
Joel Leach
Memorial Business Systems, Inc.
Tennessie, États-Unis
 
 
À
24/04/2003 14:48:02
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00781200
Message ID:
00781292
Vues:
17
Jim,

>Any ideas for dynamic bind/unbind placement?

I'm not sure what you mean by this. Can you give an example?

>>
>>I'm not sure I follow your thinking with avoiding RaiseEvent() in classes.
>
>I should think that a simple method call would work just as well within any class. Am I missing something?
>

My understanding (which could very well be wrong) is that simply calling a method on a class will not cause BindEvent() to fire. Per the VFP documentation:

Visual FoxPro does not automatically raise events for custom methods that are bound to objects using BINDEVENT( ) if the methods are called directly. For example, the following code does not raise an event:
oForm.GetMyData(cData)
Instead, to raise an event for a custom method, you need to make the following call:
RAISEEVENT( oForm, "GetMyData", cData )

Does that clear things up?

>>I guess my most common use of it will be to report the progress of the current operation, but I'm talking business logic now. In that scenario, the event binding code would probably be in a custom form method. MyForm.DoProcess() would do something like:
>>
>>- Create business process object
>>- Open thermometer form
>>- Bind business object UpdateProgress() event to thermometer Update()
>>- Start the process on the business object
>
>Ah, but that's BINDEVENT(), not RAISEEVENT(). I see RAISEEVENT() as mainly useful to better communicate the design intention of code but otherwise acting mainly like a method call.
>
>>
>>
>SNIP
Joel Leach
Microsoft Certified Professional
Blog: http://www.joelleach.net
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform