Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Subroutines in methods
Message
From
27/01/2000 15:18:02
 
 
To
27/01/2000 14:46:10
Michael Dougherty
Progressive Business Publications
Malvern, Pennsylvania, United States
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00323757
Message ID:
00323774
Views:
22
>I have a form with a megalithic PageFrame (where one of the Pages also contains a PageFrame) It take a noticeable (but not yet intolerable) amount of time to instatiate. I would gladly start over using smarter technique, if not for the time already spent...
>
>I had a program being called from a button. I realized this program will only ever be called from this one button. I moved the code into a form method, which is called by the button. The code calls a procedure which calls a subroutine. I now have 3 methods added to this form. Is there a better way to do this?

You can't add subroutines to methods, so if you want to keep your code within the form (i.e. encapsulate it), you've already done the right thing. The other option(s) would be to put code outside the form - where you might do this would be if that code will also be accessed by other forms etc. other than the current one. Some choices are:
- create a separate object that contains those methods, then reference oObject.Method(). Alternately, if you already have an Application object, the methods could be attached to it, i.e. goApp.Method()
- use separate .PRG or procedure files.

>
>Does extra code take longer to instantiate the form?

Not unless it's accessed.
>
>If i compile the project into an .exe, do i have to distribute the form files or are they compiled into the .exe? (i'm currently distributing the .sc? .prg .fxp, etc. with the .exe) I would like to ship only a .exe and the runtime .dlls.

Most people "compile" forms, classes etc. into the .EXE.
>
>Is there a FAQ on where code should ideally be placed? ie: a pro&con sheet to different strategies? I know this is the kind of thing you either learn from schooling or from an on-the-job mentor. Since i'm learning VFP while coding a mission-critical app, i have neither.

There's been lots of work put into the Files and K.B. sections here, that would be a good place to start.
>
>"Have I mentioned lately how awesome UT is?"
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Previous
Reply
Map
View

Click here to load this message in the networking platform