Boost logo

Boost :

From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2004-03-04 10:41:55


"David Turner" <dkturner_at_[hidden]> wrote in message
news:30062.165.165.239.17.1078414261.squirrel_at_webmail.telkomsa.net...
> Hi
>
> Thorsten Ottosen wrote:
>
> > Why can't window::container be like
> >
> > window::contain( const button& b )
> > {
> > b.set_owner( this );
> > add(b );
> > }
> >
> > button::set_owner( window* w )
> > {
> > owner_->remove( this );
> > owner_ = w;
> > }
> >
>
>
> It's not always that simple.

Ok, I should have stated it was pseudo code.

>In particular, on the Win32 architecture,
> changing ownership amounts to
>
> DestroyWindow(hwnd);
> hwnd = CreateWindow(TEXT("BUTTON"), label.c_str(), WS_CHILD, 0, 0,
> new_owner->get_hwnd(), 0);

yeah, I hate the win32 API.

> and from that point on things start to get complicated. So I neatly
> avoided said complications by drawing a line and saying, "on this side,
> widgets don't change owners".

Still, you could let set_owner() be called only once and throw something if
its done twice.

br

Thorsten


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk