Boost logo

Boost :

From: David Turner (dkturner_at_[hidden])
Date: 2004-03-04 10:31:01


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

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

I think it's an acceptable limitation.

Regards
David Turner


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