Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
NODEFAULT doesn't work in all events?
Message
From
24/12/2001 08:09:28
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00597789
Message ID:
00597908
Views:
13
Hi Sergey

>1. The form Refresh doesn't have DODEFAULT() or NODEFAULT
> Result: the parent class code isn't executed, form refreshes after the end of Refresh() code.

Yes. With no DODEFAULT() the instance level copde overrides the inherited code completely. With no NODEFAULT the base class code will execute after the instance code has completed.

>2. The form Refresh has DODEFAULT() only
> Result: the parent class code executed, the rest of form Refresh() code runs and form refreshes after the end of Refresh() code.

Yes, but the Refresh() of controls on the form will be called TWICE. Once by the Parent code refresh() and once by the instance level Refresh(). (This is Tom's problem!).

>3. The form Refresh have DODEFAULT() and NODEFAULT
> Result: the parent class code executed and form refreshes, the rest of the form Refresh() code runs w/o second form refresh.

Exactly. This is the solution to Tom's problem as both Bonnie and I have told him <g>

>4. The form Refresh has NODEFAULT
> Result: the parent class code executed, the rest of form Refresh() code runs. No form refresh at all?

No. Without a DODEFAULT() the parent class code is overridden (see 1. above). All that will happen is that the code in the instance will be executed without any form refresh occurring.

>Also, I don't see any way to execute parent and form Refresh() coded and get form refresh at the end of form's Refres() code only.

Rather say "No easy way" <g> The solution is, of course, not to place the code directly in the Refresh() method. Instead use custom methods (I use one called 'BeforeRefresh()') and then code the class level Refresh() method like this:
IF This.BeforeRefresh()
    This.Refresh()
ENDIF
Now my 'BeforeRefresh' method is where I put all the code, the DODEFAULT and so on, but since the only Refresh ever called is the one in the instance (and that merely inherits the class code WITHOUT the need to override) - you only get ONE refresh at the end of the custom code in BeforeRefresh (and only if that method returns .T.)

The root of the problem is that Refresh() is not actually a form level method in the sense that it doesn't actually DO anything itself. It merely loops through all of the controls that are currently in scope and calls their Refresh hence the double hit when you call a Refresh from more than one level.
----
Regards
Andy Kramek
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform