Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Dynamic methods in form 3
Message
De
02/05/1997 04:35:15
 
 
À
30/04/1997 14:13:51
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00030315
Message ID:
00030578
Vues:
33
>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!
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform