Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Changing Methods field in MyForm.SCX
Message
From
09/04/1998 21:01:37
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00090757
Message ID:
00090958
Views:
28
>>I want to make similar changes to many forms so I plan to write a simple program to work against the Methods field in each of my forms' SCX tables. This is the memo field where the form's method code is kept as procedures.


>Bob,
>
>Is there a reason you aren't using a Form Class to handle the commonality?


On re-reading my original question, I understand your concern. Here’s what I’m up to.

I started a thread (#90237) a few days ago called “DoDefault() as a Standard” in which I was looking for help in determining how to make sure that class based parent code wasn’t accidentally blocked from running by child code without a DoDefault(). (Including the case when baseclass code was added after the code which became child code.)

Nancy Folsom mentioned hooks as a solution. It seems that Steven Black, Barbara Paltiel, and Mark Mccasland all encourage or use this approach. Although I thought I understood the use of hooks, somehow I had never thought of hooks as a defense strategy. I am now in the early stages of figuring out if this approach will work in my framework (I wrote it), and if there are any undesirable side effects. My current plan is to add a collection of “My” methods to my base classes ... e.g. MyClick(), MyLostFocus(), MyLoad(), etc.

The programmers using this framework will have to restrict themselves to writing method code ONLY in the methods that start with “My”. Each of the “normal” methods, such as Load(), would include my normal base code, followed by this.MyLoad() to pick up any locally required extra stuff. In cases where the child code should run first, such as in KeyPress(), the KeyPress() Code would START with this.MyKeyPress() and then be followed by my normal KeyPress() code.

But back to your question ... I don’t want to move all the existing WhatEver() method code into the new corresponding MyWhatEver() method manually, so I plan to write a MoveMethodCodeToMyMethod.PRG program, and run it instead against ALL my existing SCX files. I was just checking out whether or not I would be stuck with a mismatched Methods field / ObjCode field in my SCX. (I have since been told by John Petersen that “Compile Form MyFile” will make things right again)

If anybody sees a flaw in this approach, or can think of any side effects that should be accommodated, I would appreciate hearing of them.

Bob
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform