Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Can an object know of it's existence?
Message
De
02/12/2003 14:22:15
 
 
À
02/12/2003 13:33:08
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Divers
Thread ID:
00855003
Message ID:
00855138
Vues:
22
Counterexamples:
= createobject("custom")
with createobject("custom")
   * ...
endwith
return createobject("custom")
What are the names of the created objects?
local o1, o2, a[1]
o1 = createobject("custom")
o2 = m.o1
a[1] = m.o1
What is 'the' name of the created object?

As I said, if you need a global name then you need a global anchor of sorts. Fernando's suggestion is the easy to implement and should be fairly robust, especially if you make good use of SYS(2015) where appropriate. If you want to keep the number of global names used to a minimum then a CUSTOM object could serve as a collection (.AddObject your objects to it with a SYS(2015)-enhanced name so that you can access them by name or via the .Controls collection). This registry object would consume only one global name but it could provide any number of globally reachable names for your objects. If you .AddObject the registry object - or your objects themselves - to the global _SCREEN object then they will survive a CLOS ALL and a RELE ALL EXTE. *g*
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform