>Hi,
>
>What is a good practice when a form is based on another form, as far as where to place the dodefault() in the child form?
>
>My feeling is that it should be at the top of the child form method. For example.
>
>Say a base form is mybaseform (in MyBaseForms.vcx). And it in the INIT method of this form there is a code.
>
>Then you create a new form MyChildForm based on the MyBaseForm. And it has some code in the INIT() method too. I think that in the child form INIT method the sequence should be as follows:
>
>
>*-- Init method of child form
>dodefault()
>*-- put the code specific to the child form INIT method
>
>
>Does the above make sense or there is/are issue(s)?
Yes, that's the right idea. Some comments:
1. You're avoiding the rookie/too little coffee mistake of forgetting to call DODEFAULT() at all, when you actually need the parent class code ;)
2. If your method takes parameters, remember to pass them in DODEFAULT()
3. Exactly where you place DODEFAULT() depends entirely on your code requirements. In some frameworks you see code like this:
LPARAMETERS tuParm1, tuParm2, ...
=This.BeforeInit( tuParm1, tuParm2, ... )
=DODEFAULT( tuParm1, tuParm2, ... )
=This.AfterInit( tuParm1, tuParm2, ... )
This gives a place to put code you'd like to run before or after a given method's default code, without having to override parent code or worry about exactly where to place DODEFAULT().
Regards. Al
"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov
Neither a despot, nor a doormat, be
Every app wants to be a database app when it grows up