CLEAR lof=CREATEOBJECT("ClassName") ?lof.name lof.name = 'bla' *new name, old class (why should the class change?) ?lof.name,lof.class DEFINE CLASS ClassName AS Custom *this defines the .class property as well as the name of an object instansiatet without giving it a name *(=CREATEOBJECT(...) vs. _screen.CREATEOBJECT('objname',...)) Name = 'ObjectName' PROCEDURE Init ? "Class expected <ClassName>, Observed :" ,this.Class,this.name *Agnes remark: *next line sets the name of the object! * this not set Class, because this runs in an object this.Name = "AnotherName" ? "Class expected <ClassName>, Observed :" ,this.Class,this.name ENDDEFINEAgnes
>>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 >>>>
>>>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 >>>