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 08:06:26
 
 
À
25/09/2019 06:43:13
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01671046
Message ID:
01671108
Vues:
62
>>>>It will take me 10 years to refactor all places where I have code in the event method (e.g. cmdSave.click()) :)
>>>
>>>Start with the ones where you're calling that code from elsewhere. There should never be calls to event methods.
>>>
>>>Tamar
>>
>>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.

Why do you say that, Tamar? The code is encapsulated in the .click() event. Why create a new custom method and call that method from .click() and the place where you would use someForm.cmdSomeButton.click()? Why not keep it in .click() and call it there?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform