Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using Modeless forms in a very large program
Message
From
25/01/2008 10:04:39
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01284682
Message ID:
01285512
Views:
27
>>Not putting code into forms is a mistake in an OOP environment. However, presumably, lots of code should be common to many of your forms. So your first step should be to develop some form classes that contain all the common stuff. Then base your forms on those classes.
>>
>>Tamar
>
>Tamar,
>There are two reasons we use our current method of calling a prg that runs the form:
>1 - Much easier to maintain the code as it is all in one prg and not in some number of methods that must be opened seperatly.
>2 - It decreases the size of the final .exe which now is approaching 10 MB.
>
>What is the difference between putting code in a form and having the code in a prg as far as OOP is concerned? I thought it would be the same.
>

I see no reason having the code in PRG rather than a form would reduce EXE size, unless you mean that many forms call the same PRGs. If that's the case, then OOP is exactly what you need.

You put all that common code into a form class, and base all your forms on that class. The code is there only once, in the class definition, but all the forms have access to it, and those that need to extend it can do so.

For example, in one application I'm working on, one of the criteria is that users have to be able to print out the forms exactly as they look on screen. So I have a method in the base form class for that app that prints out the form. Every form I base on that class can use that method.

As for the maintenance issue, that's a matter of personal taste. I love the fact that I can open several methods at once and work on them in parallel when I need to. In a PRG, I have to flip back and forth between them.

Tamar
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform