Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Class and Instance Logic
Message
From
01/08/2001 09:04:56
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Class and Instance Logic
Miscellaneous
Thread ID:
00538248
Message ID:
00538248
Views:
46
Is the following an example of a sound practice, or is there a better approach?

Command button class named: cmd_ClassNew

First instance: ThisForm.PageFrame.Page1.cmd_New1
Second instance: ThisForm.PageFrame.Page2.cmd_New2

In cmd_ClassNew.Click there is code to run ThisForm.AddProc().

In both cmd_New1.Click and cmd_New2.Click is code to store the current view as ThisForm.CurrentView. Then I issue DoDefault() and perform things like PageFrame.ActivePage and Object.SetFocus relevant to the particular instance.

The ThisForm.AddProc() method contains code to add a new record based on the ThisForm.CurrentView. I use a case statement to handle the logic.

Any opinions? I apply this logic to other objects as well, but command buttons were the easiest to describe. Seems I've read somewhere that objects should only know about themselves (or something like that) and wondered what the best way to handle class/instance logic was. Just trying to make sure I'm doing the best by my apps. Thanks!

Renoir
Next
Reply
Map
View

Click here to load this message in the networking platform