Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2004-03-04 08:59:12


"David Turner" <dkturner_at_[hidden]> writes:

>> Hm...maybe I don't understand why it has to be that way?
> [snip]
>> why can't we say
>>
>> window w;
>> w.add( button( "Click me" ) ); (*)
>>
>
> As I explained in an earlier post to Peter Dimov, there are technical
> reasons why this isn't possible. Widgets have to be rooted in an owning
> window, and it's not possible to transfer widgets from one window to
> another. Therefore, button has to take an owner-window parameter in its
> constructor.

button("click me") doesn't have to be a widget. Think expression
templates. It can just build up a type to be used by window to add a
button.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

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