On Dec 19, 2007 11:46 AM, Ed Leafe <[EMAIL PROTECTED]> wrote:

> 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.


OK, fair enough.

In my mindset, those two controls should be in a container (VFP speak) and
communication directed to the container, then subclass the container as need
be.

As you indicate, this can be considered overkill.

Nevertheless, that's how I'd do it.

Thanks,

Bill


--- StripMime Report -- processed MIME parts ---
multipart/alternative
  text/plain (text body -- kept)
  text/html
---

_______________________________________________
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