Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
PRG Classes and Forms
Message
De
12/07/2007 14:41:28
Irv Adams
MSC Managed Care, Inc.
Floride, É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:
01239846
Vues:
12
>>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!
>
>I don't know what you are trying to accomplish, but in any case this is what I'd do if I wanted to create a class definition in a form method (or any other class method):
>
>TEXT TO lcClassDef TEXTMERGE NOSHOW
>*-- Just an example of a form class:
>DEFINE CLASS MyFormClass AS Form
>	Backcolor = 0
>	LEFT = 0
>	TOP = 0
>ENDDEFINE
>
>ENDTEXT
>*
>THISFORM.cClassDefinition = FORCEPATH(FORCEEXT(SYS(2015),"PRG"),GETENV("TEMP"))
>*
>STRTOFILE(lcClassDef,THISFORM.cClassDefinition,0)
>COMPILE (THISFORM.cClassDefinition)
>*
>*-- In another method in your form call first the code above in a method and then instantiate your class that way:
>loForm = NEWOBJECT("MyFormClass",THISFORM.cClassDefinition)
>loForm.SHOW(1)
>
>
>HTH


Christian,

Your code looks pretty interesting. It appears you can get around not being able to define a class in a form method this way. Fox code is so flexible.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform