Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to Create Sub Methods or Process in Form Methods
Message
From
21/03/2018 08:12:23
 
 
To
20/03/2018 16:58:35
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01658879
Message ID:
01658902
Views:
40
Likes (1)
>Hi,
>I have a Form Named "Form1" in which there is a command Button 'Process'.
>Inside the CLICK of Command Button I am executing various methods for my process one by one like
>
>Thisform.pspagecount()
>Thisform.Compress()
>Thisform.ps2PDF()
>Thisform.unmark()
>
>It is fine unless my codes inside these all methods are small and little
>
>However, I need to call several other routines and methods from my Compress(). I mean to say that there are many components of Compress() which I need to call. If I include all routines and Methods in Thisform.Compress(), it is becoming Messy and not properly understandable.
>
>What is the proper solution to the above.
>
>I have several Methods routines etc which I need to call from Inside Compess() and Finally return Back to the original Track

Tore's right that you can just create as many methods as you need, but looking at what you're doing, I wouldn't use form methods at all. I'd create a separate class (based on Custom) that contains all the method I need for the process. Then, I'd instantiate an instance of that class in the form and hold a reference to it in a form property and call methods of that instance.

I don't know enough about what you're doing to know whether you could create a single method in the new class that is the master for the process and have it call the class's other methods, so that the form only needs to call that one master method.

The advantage of creating a separate class is that you can use in different forms and even, if it makes sense, turn it into a COM object that can be used by other applications.

Tamar
Previous
Reply
Map
View

Click here to load this message in the networking platform