Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Object properties created dynamically
Message
From
04/08/1999 19:23:56
 
 
To
04/08/1999 16:05:38
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00249948
Message ID:
00249991
Views:
18
>Hi!
>
>Since it's my first post here, i want to say that my native language is French so excuse my poor english.
>I want to know if it's possible to create dynamically the properties of a custom object.
>
>Something like: (i know this won't work)
>DEFINE CLASS test AS CUSTOM
>
>FOR x = 1 TO lnNb
> PROTECTED &laVar(x)
>ENDFOR
>
>
>Thanks,
>
>Vincent

You can't use syntax like the above, because the only code that can run in a programmatic class definition has to be wrapped in a PROCEDURE with a name. You can do what you are trying to do though, with a visual class using the AddProperty method. Just get a reference to the design time object using ASELOBJ() or SYS(1270), and then run all the code you want from the command window or in a program, calling AddProperty.

PUBLIC o
o = SYS(1270) && Holding mouse over the object in the designer

FOR x = 1 TO lnNb
o.AddProperty(laVar + ALLTRIM(STR(x))
ENDFOR

AddProperty can only add public properties though...
Erik Moore
Clientelligence
Previous
Reply
Map
View

Click here to load this message in the networking platform