Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
PRG Classes and Forms
Message
De
10/07/2007 16:13:44
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
10/07/2007 15:19:20
Jay Johengen
Altamahaw-Ossipee, Caroline du Nord, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01239057
Message ID:
01239087
Vues:
15
>I think this won't work, but I want to have a method in my form that calls a method and in that method classes are defined... or something like that. Can I mix forms with text-based classes? Do I have to put them into the Main program that calls the form? Thanks!

Several strategies to choose from. First, where to put the classes:

- Stuff all your prg-based classes in one big prg and rely on CodeRef and Document View to find them
- group them in several smaller prgs (same remark)
- one class per prg, where prg and class have the same name, or where you can derive one from the other

How to instantiate them:

- have a long Set Procedure statement (I wrote a generator for that one, if you want, works fine and fast with more than a hundred prgs) and use just CreateObject() to instantiate. Pro: you don't need to know where your class is defined. Con: you don't really know where your class is defined.

- use newobject() or .newobject(). Pro: you don't need a Set Procedure statement for all those prgs, and you are forced to have a good naming convention so you can find your classes. Con: You need to know the names of the prgs, and you are forced to have a good naming convention so you can find your classes.

- in some cases (page, column) you can just set the class and classlib for member objects to your class and the prg (though it didn't work when I tried, but then I wasn't too stubborn to make it work, having found a workaround in two minutes).

In the first two cases, you can instantiate such an object pretty much anywhere where you can write code - in a prg, vcx code snippet, menu code snippet, report DE events, code in ExecScript() etc etc.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform