Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Getting object reference via indirection?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 8.1
Network:
Windows Server 2012
Database:
Visual FoxPro
Application:
Desktop
Virtual environment:
VMWare
Divers
Thread ID:
01638766
Message ID:
01638768
Vues:
54
J'aime (1)
>Hi all,
>
>I wanted to write some generic code that would continue to work even if I added objects to a screen at runtime.
>
>Is there another way to get an object reference to a screen object when part of the name is in a var?
>
>I know I can use PEMSTATUS() to test if the object exists. Say that below was in a loop to test for a dozen objects
>
>lnLoop = 5
>
>lcObjectName = "label" + LTRIM(STR(lnLoop))
>
>IF PEMSTATUS(THISFORM,lcObjectName,5)
>
> loLabel = THISFORM.&lcObjectName
>
>ENDIF
>
>Is there any other way to get a reference to the object other than macro expansion? I think I figured this out once but dang if I can find it.
>
>Thanks,
>Albert

Check getPEM(), for example:
loForm		= GETPEM(_screen, 'ActiveForm')
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform