Paul,

We are actally trying to initialize a new object.  The getattr appears to
work for existing object.

For example, we want to create x instances of a bizobj

Looking for code that would do the equivalent of

For i=1 to x
Self.biz1=dabo.biz.dBizObj
Self.biz2=dabo.biz.dBizObj
...
Self.bizx=dabo.biz.dBizObj
Etc,

Thanks,
Larry

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Paul McNett
Sent: Wednesday, September 12, 2007 4:47 PM
To: Dabo Users list
Subject: Re: [dabo-users] what is the replacement of VFP macro's

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


[excessive quoting removed by server]

_______________________________________________
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