Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Adding code to every form/WriteMethod
Message
 
 
To
26/03/1998 12:47:26
Elyse Pomerantz
Dynamic Data Concepts, Inc.
Brooklyn, New York, United States
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00087353
Message ID:
00087493
Views:
35
Elyse,

A fundamental rule of overriding ANY method to augment behavior is to make sure you include either :: or DoDefault() to make sure you execute inherited code, even if you know there is no code in the class to inherit today, doesn't mean there won't be code there tomorrow.

If your forms don't have any code in their Init() method you don't have to do anything at all, they will automatically execute the class code. If your form has code in the Init() method you should have out of habit put a DoDefault() in. If you are going to programatically fix this oversight you'll have to check to make sure a :: of DoDefault() isn't already there, and then add it, but I'm not sure you can just always say it should go at the top or the bottom of the method, it depends on what the class code does and what the form code does.

The reason you hosed your forms was you changed the Methods memo without wiping out the ObjCode memo.

>I added some code to the Init method of my form class and now I want to make sure this code is executed for all forms. The hard way would be to open up every form and add a DODEFAULT() to every Init method that has other code. Is there an easier way? Can I use WriteMethod to do this? What exactly does WriteMethod do and how is it used at design time?
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform