
4 Mar
2004
4 Mar
'04
3:31 p.m.
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