Paul McNett wrote:
> johnf wrote:
>> Hi,
>> in VFP I would use "&variable."  How do I do the same for Dabo?
>> I.e I want the following to work
>>
>> curlabel = "test"+"01"
>> self.&curlabel. = "somestr"  ## where self is an object
> 
> self.getattr(curlabel).Caption = "somestr"
> 
> This assumes that self has a label that is named 'test01'.

Oops, sorry, I keep forgetting that getattr() is a builtin function, and 
not a method of Python objects. Here's the actual answer:

getattr(self, curlabel).Caption = "somestr"

Actually, you'd be better off checking that you have an object first:

lbl = getattr(self, curlabel, None)
if lbl:
        lbl.Caption = "somestr"

HTH

-- 
pkm ~ http://paulmcnett.com


_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/dabo-users/[EMAIL PROTECTED]

Reply via email to