John,
That's kinda what I did. Something that I found out that's cool is that we
can specify parameters in the Dynamic and other properties that are
references to methods.
For example, in stead of having a different method for each i.e.
self.obj1.DynamicBackColor=self.setobj1BackColor
Self.obj2.DynamicBackColor=self.setobj2BackColor
def setobj1BackColor(self):
if self.obj1.Enabled:
return('white')
else:
return('gray')
def setobj2BackColor(self):
if self.obj2.Enabled:
return('white')
else:
return('gray')
We can...
self.obj1.DynamicBackColor=(self.setobjBackColor,self.obj1)
Self.obj2.DynamicBackColor=(self.setobjBackColor.self.obj2)
def setobjBackColor(self, obj):
if obj.Enabled:
return('white')
else:
return('gray')
Larry
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of John
> Sent: Tuesday, November 24, 2009 11:53 AM
> To: Dabo Users list
> Subject: Re: [dabo-users] Using setAll
>
> 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]
>
_______________________________________________
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/!~!uenerkvcmdkaaqacaaaaaaaaaaaaaaaaabgaaaaaaaaaafa2fnyupuomnfpiynbeqckaaaaqaaaa8ogfau6lxuyqkexhamm4raeaa...@charter.net