On Tuesday 24 November 2009 08:02:18 am Ed Leafe wrote:
> On Nov 24, 2009, at 9:57 AM, <[email protected]>
>
> <[email protected]> wrote:
> > Is there a way to reference the "kid" object using the setAll
> > command? I
> > want to be able to set the DynamicBackColor by doing something like
> >
> > self.setAll('DynamicBackColor',(self.setColor,kid))
>
>       No, of course not - that's basic Python lexical scoping.
>
> > def setColor(self,obj)
> >    if obj.Enabled:
> >        obj.BackColor='red'
> >    else:
> >        obj.BackColor='white'
>
>       Why not just call setAll() twice, once each with a filter on Enabled
> = True/False, and the appropriate value for the filter?
>
>
> -- Ed Leafe

I'm not sure I understand Ed's response so I'm adding my .02.

Why not just use obj.Children?  

for child in obj.Children:
   if isinstance(child, some_base_type):
       DynamicBackColor = self.setColor

or maybe use RegID in the loop.

if 'ID' in child.RegID:
        DynamicBackColor = self.setColor

I have found the loop over children to be very fast.  Check out what I did for 
the editmode in court_ordered.

Johnf


_______________________________________________
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/[email protected]

Reply via email to