Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to move Form Methods to .prg as non-visual class?
Message
From
21/03/2006 18:09:12
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
How to move Form Methods to .prg as non-visual class?
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows 2000
Network:
Novell 5.x
Database:
MS SQL Server
Miscellaneous
Thread ID:
01106452
Message ID:
01106452
Views:
65
I am writing a system and want to strip the code out of the form methods and put it in a .prg file. The forms are already sub-classed from a parent form so they inherit all the common properties and method names they need to work with a dataclass for the application. I prefer to edit methods outside of forms because I have bad vision so I keep my resolution low and don't have much screen editing space. I can also find mistakes faster in a .prg file. There are customer 27 methods on each form that need to be edited for the table the form is using, and I think it will much easier to manage them in the .prg.

I have read several threads on this (827299, 415216, 314465, 331088, 70069) and it sounds like the best way to do this is to make a business object for the table the form is working with and load that class on the form.

How do I load a non-visual class onto the form? Do I instantiate it in the load method? Once the form is open how does the form call the object?

For instance I have a validateform method that checks to see all the required fields are filled in, there are no duplicate keys in the table, and at least one checkbox is marked defining the record type. When I move this method into the object how do I call it and since the object loads on the form will the object see all the controls on the form?

Since the form is subclassed I could even establish a naming convention and give the business object the same name as the form so that when form ‘frmResource’ opens it loads non-visual object ‘frmResourceObj.prg’

TIA,
Margaret Gillon
Next
Reply
Map
View

Click here to load this message in the networking platform