Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Do I need DoDefault() in Refresh()?
Message
From
10/03/2021 22:47:05
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01678879
Message ID:
01678904
Views:
41
Hi Dmitry.

>I have some code in the form method Refresh(). In the end of this code I have dodefault(). I also added some test code into a container's Refresh method (just to see when it fires). So, when I have DODEFAULT() in Refresh method, the Refresh of the Container fires twice on every record move. If I comment the DODEFAULT() in the form Refresh(), the Refresh() in the container fires once.
>Which brings me to the question, what is the purpose, and if I need, DODEFAULT() in the form refresh()?

You don't need a DoDefault() in the Refresh code.

DoDefault() is used to call the code that would have been called it your code wasn't there. Some methods on objects are actually event handlers and operate differently than normal methods. It can get a little confusing. Refresh is one that will propagate without your help. For those sort of code blocks you can use the NoDefault statement to prevent that. For example, if you include a NoDefault in KeyPress() then the key event won't reach the handler that processes it. That would prevent the character from appearing in a TextBox for example. You can even do a NoDefault and then a DoDefault() to pass different information than was intended.

Ian Simcock.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform