On Dec 19, 2007, at 1:44 PM, Bill Anderson wrote:

> Ed -- OO question -- when should a control know about a sibling  
> control? I'm
> trying to think of a case where that would be true and I can't come  
> up with
> one...

        Let's say you're creating a reusable component that is designed to  
drop on several forms. Since you can't assume anything about the  
form, your controls will communicate via self.Parent (i.e., the  
container in which they reside). But sometimes it's just simpler to  
work directly; imagine a check box that controls whether a text box  
is enabled or not. The code could be:

def onHit(self, evt):
        self.Parent.txtPhone.Enabled = self.Value

        Sure, you can be purist and communicate via the container, but  
there's something to be said for simplicity sometimes.

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com




_______________________________________________
Post Messages to: Dabo-users@leafe.com
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