Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can execute a button click method without showing the fo
Message
From
25/09/2019 16:10:57
 
 
To
25/09/2019 08:15:12
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01671046
Message ID:
01671136
Views:
64
>>>>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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform