Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Can execute a button click method without showing the fo
Message
De
25/09/2019 17:02:12
 
 
À
25/09/2019 16:10:57
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01671046
Message ID:
01671138
Vues:
60
>>>>>Just to clarify, when you are saying "never be calls to event method", you mean never code like this?
>>>>>
>>>>>*-- Some procedure or a method calling the click of a button:
>>>>>SomForm.cmdSomeButton.Click()
>>>>>
>>>>
>>>>Yes, that's what I mean. If you find yourself writing code that calls Click or KeyPress or GotFocus or ..., that code belongs in a method that's called from the event and from whatever the other place is.
>>>
>>>Almost as a rule, as soon as I moved the code from .click() of a button into a form's method, there would arise another place which would need to use the same code - either a popup, or a toolbar button, or some bound event. Only in rare occasions would the button be the only caller of that method.
>>
>>Why not just call the .click() event to run the code from those new places that pop up?
>
>Probably because you might have code in that click() event that is specific to that event -- code that probably isn't applicable nor desirable to be run outside of the click() event.

The other posters are talking about taking that code out of the click() event and putting it in a method, and then only having a stub in the click() event like this:
* EVENT Click
thisForm.my_click_event_code()
So, whatever code is there in the click() event, would be there in the my_click_event_code() as well. Wouldn't it?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform