Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Dragover and calling another method problems
Message
De
30/05/2006 12:06:13
Mike Yearwood
Toronto, Ontario, Canada
 
 
À
30/05/2006 11:38:22
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Divers
Thread ID:
01125469
Message ID:
01125911
Vues:
20
>>>I disagree with this theory -- methods can not call or trigger an event. Events trigger methods. The Click() code contained in an object (form, control, etc) is not the event -- it is the method code called as a result of the event. Calling one object's Click() code from another object's method code is no different than calling a custom named method. The actual event (in this case, button click) is not raised by one method calling the click() code.
>>
>>It's you own theory that method cannot call an event. It certanly can.
>>Again, a method can trigger an event by using RAISEVENT() function but not by calling code bihand it.
>>However a method shouldn't call an event code for reasons explained in the wiki article.
>
>yes I am aware that a method can raise an event -- by calling the command RAISEVENT(). But this is not the same as calling the method code directly:
>
>thisform.cmdSomeButton.Click()
>
>In this the above, only the method code contained is executed (the event is not raised). If the following is used:
>
>RAISEVENT(thisform.cmdSomeButton,"Click")
>
>Then the click event is executed (same as user pushing the button), and the code in the Click() method is executed. Additionally, default behaviour of the click event is occuring.
>
>This is a matter of opinion as to the placement of code; I don't see any value (but added complexity) to have a event call a single method:
>
>
>PROCEDURE Click
>thisform.CallSomeMethod()
>ENDPROC
>
>
>I would rather the code specific to a object be placed in the event called method. This is easier to read in my opinion and to follow. Take for example an drop-down combo box:
>
>The Init() event method code sets the initial values for display; the InteractiveChange() event method code is used to trigger further user interaction (such as providing for changing allowed values in a child object). Having the code directly in the control is easier to follow the logic of calling and execution. Having it in separate methods makes it more difficult to determine where and when the custom method name is called.

Spelunking through the form for the code hidden in various places isn't fun.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform