Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Object command propagation
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00577124
Message ID:
00577355
Vues:
18
This message has been marked as the solution to the initial question of the thread.
What you are asking for for is something like the functionality of a collection. You can program your own functionality using the Access method of a property and a wrapper array property. Try something like the following:
CLEAR
SET PROCEDURE TO dummy.prg
anObject=CREATEOBJECT('dummy')
? anObject.dummy(1).class
* Line below fails.
? anObject.getDummy().class
* workaround is
temp=anObject.getDummy()
? temp.class
WAIT window

** Class dummy
DEFINE CLASS dummy as Custom
DIMENSION dummy[1]
dummy(1)=null
dimension GetDummy[1]

FUNCTION init()
this.dummy(1)=CREATEOBJECT('custom')

FUNCTION GetDummy_Access()
lparameter tnIndex
if vartype(tnIndex) $ 'YNIB' then
	RETURN this.dummy(tnIndex)
else
	RETURN this.dummy(1)
endif
ENDDEFINE
Note: This workaround makes the other workaround fail.

>Any suggestions or is this a wish list item.
>
>
>* test program. in each case return a 'custom' object and we want to know the
>* class. However the second ? line will fail.
>CLEAR
>SET PROCEDURE TO dummy.prg
>anObject=CREATEOBJECT('dummy')
>? anObject.dummy(1).class
>* Line below fails.
>? anObject.getDummy().class
>* workaround is
>temp=anObject.getDummy()
>? temp.class
>WAIT window
>
>** Class dummy
>DEFINE CLASS dummy as Custom
>DIMENSION dummy[1]
>dummy(1)=null
>
>FUNCTION init()
>this.dummy(1)=CREATEOBJECT('custom')
>
>FUNCTION getDummy()
>RETURN this.dummy(1)
>
>ENDDEFINE
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform