Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
PRG Classes and Forms
Message
From
12/07/2007 14:41:28
Irv Adams
MSC Managed Care, Inc.
Florida, United States
 
 
To
11/07/2007 00:07:11
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01239057
Message ID:
01239846
Views:
13
>>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.
Previous
Reply
Map
View

Click here to load this message in the networking platform