Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Dynamic methods in form 3
Message
From
02/05/1997 04:35:15
 
 
To
30/04/1997 14:13:51
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00030315
Message ID:
00030578
Views:
31
>can i add methods to a form in runtime?
>
>classes maybe?
>
>thnks
>reply ASAP
>Ariel Pablo Klein


Yes, what you want is a STRATEGY design pattern.

You have to be able to define a standard interface (method names, parameters) for the different processes you want to carry out.

Let's say you decice to call the method DoAction and it needs no parameters for simplicity.


Then you can use code like:

THISFORM.AddObject("oStrategy","CreateACursor")

Then call THISFORM.oStrategy.DoAction()


But if you want it to do something different...

THISFORM.RemoveObject("oStrategy")
THISFORM.AddObject("oStrategy","CreateATable")

Then call THISFORM.oStrategy.DoAction()



The key concept here is the standard interchangeable interface which MUST not be different for each action that is to be carried out.


I recommend you look out Design Patterns by Gamma, Help, Johnsson and Vlissides.
Also the Revolutionary Guide to Visual FoxPro by Phelps and Kramek.

Sorry, don't have ISBNs handy - use www.amazon.com as a book enquiry system even if you don't buy from them!
Previous
Reply
Map
View

Click here to load this message in the networking platform