Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Get Object Reference to Form Control
Message
De
10/09/2004 15:03:43
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
10/09/2004 14:45:35
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00941146
Message ID:
00941175
Vues:
11
This message has been marked as the solution to the initial question of the thread.
>>>VFP5
>>>
>>>I have some checkbox controls in a Container-based Business Object. They are numbered sequentially Check1, Check2, etc.
>>>
>>>I need to process these sequentially and enable or disable them appropriately. I'd like to use a FOR loop but the method I'm using to get an object reference to each checkbox seems kludgy. Can anyone see a better way?
LOCAL ;
>>>  lcCheckBoxName, ;
>>>  loCheckBox
>>>
>>>FOR lnIx = 1 TO SomeNumber STEP 1
>>>  lcCheckBoxName = "This.Check" + LTRIM(STR(lnIx))
>>>  loCheckBox = &lcCheckBoxName
>>>  * Name expression or EVALUATE() don't work in above line
>>>
>>>ENDFOR
>>
>>
>>FOR lnIx = 1 TO SomeNumber STEP 1
>>  with eval( "This.Check" + LTRIM(STR(m.lnIx)) )
>>   *...
>>  endwith
>>ENDFOR
Cetin
>
>Nice, Cetin! Thanks.
>
>UPDATE: My original code DOES work with EVALUATE(). I thought I had tested this, obviously not. The VFP5 docs don't say anything about EVALUATE() being able to return an object reference, but evidently it can, as shown nicely by Cetin's code.

I believe when you tested you just missed it with one letter or dot:) FYI in the same manner this works too :

store Something to ("This.Check" + LTRIM(STR(m.lnIx)) + '.Someproperty')

Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform