Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can execute a button click method without showing the fo
Message
From
24/09/2019 13:02:25
 
 
To
24/09/2019 12:52:07
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01671046
Message ID:
01671087
Views:
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

I disagree with this advice. Calls to event methods are essential to simulate the user activity programmatically. Every app I've worked on since the 1990s and VFP3 uses them routinely. We've never had any issues. We've even added parameters to things like the Click event, so that we can pass in a flag indicating it comes from a call rather than the default event.

VFP is very flexible in this regard. I would never advise people not to call events, and especially so the IneractiveChange, ProgrammaticChange, Before/AfterRowColChange, or Click events. These all have particular purpose and are useful in event-driven and procedural-driven code.

-----
I've looked at the Wiki page and it suggests calling methods to do the work that could otherwise be done in the event.

If you're building a class hierarchy I would agree with this. If you're dealing with base classes and parent classes culminating onto the final presentation on a form or class at the user-level, then anything you add to that final presentation, any event or method code is fully acceptable at that level. And I would debate anyone who says otherwise. :-)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform