Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
BUG: Set class's Name change the object's Class property
Message
De
06/12/2007 08:13:53
 
 
À
06/12/2007 07:14:33
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Allemagne
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Divers
Thread ID:
01273530
Message ID:
01273544
Vues:
12
Agnes,

you can use every trick, but this is an insect in environment of OOP quite defined.

A lot of VFP commands lose consistency

Example:
CLEAR

z=CREATEOBJECT("ClassName")

* VFP known a Class
? AMEMBERS(AP,z.Class)

* but it cannot create a Class object !!!!
k=CREATEOBJECT(z.class)


DEFINE CLASS ClassName	AS Custom
	Name	= 'ObjectName'

   PROCEDURE Init
	? "Class expected <ClassName>, Observed :"	,this.Class
        * this not set Class
	this.Name = "AnotherName"
	? "Class expected <ClassName>, Observed :"	,this.Class
ENDDEFINE
>Fabio,
>
>Please this is a feature.
>I use this one down the days where we start with the memberclass* stuff. (There must be an old thread of this)
>
>This one allows you to subclass a member like optionbutton but keep the names like Option1, Option2 .. instead of something strange like myopt1 or so.
>
>See example
>
>CLEAR
>
>=CREATEOBJECT("mygroup")
>=CREATEOBJECT("mygroup2")
>
>DEFINE CLASS MyOpt	AS OPTIONBUTTON
> NAME = 'MyOpt'
>ENDDEFINE &&MyOpt	AS OPTIONBUTTON
>
>
>DEFINE CLASS MyOpt2	AS OPTIONBUTTON
> NAME	= 'Option'
>ENDDEFINE &&MyOpt2	AS OPTIONBUTTON
>
>DEFINE CLASS mygroup AS OPTIONGROUP
> MEMBERCLASS = 'MyOpt'
> MEMBERCLASSLIBRARY = THIS.CLASSLIBRARY
>
> BUTTONCOUNT = 0
>
> PROCEDURE INIT
>  THIS.BUTTONCOUNT = 2
>  ?THIS.CLASS,THIS.OBJECTS(1).NAME
> ENDPROC &&mygroup.init
>ENDDEFINE &&mygroup as optiongroup
>
>DEFINE CLASS mygroup2 AS OPTIONGROUP
> MEMBERCLASS = 'MyOpt2'
> MEMBERCLASSLIBRARY = THIS.CLASSLIBRARY
>
> BUTTONCOUNT = 0
>
> PROCEDURE INIT
>  THIS.BUTTONCOUNT = 2
>  ?THIS.CLASS,THIS.OBJECTS(1).NAME
> ENDPROC &&mygroup2.init
>ENDDEFINE &&mygroup as optiongroup
>
>
>Sp you can mimic your member* stuff in existing classes. O.K.?
>
>HTH
>Agnes
>>Set the Name property into a class definition change it's Class property to the name value.
>>
>>
>>CLEAR
>>
>>=CREATEOBJECT("ClassName")
>>
>>DEFINE CLASS ClassName	AS Custom
>>	Name	= 'ObjectName'
>>
>>   PROCEDURE Init
>>	? "Class expected <ClassName>, Observed :"	,this.Class
>>        * this not set Class
>>	this.Name = "AnotherName"
>>	? "Class expected <ClassName>, Observed :"	,this.Class
>>ENDDEFINE
>>
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform