
Angus Leeming wrote:
David Turner wrote:
window w("Test"); button b = w.spawn("button"); b.label("Click me"); w.contain(b);
Excuse me butting in, but this is redundant information: // b belongs to w button b = w.spawn("button"); // b belongs to w w.contain(b);
No, they are _not_ redundant. Writing "w.contain(b)" doesn't mean b now belongs to w. It says nothing about ownership. What it says is that w _contains_ b. On the other hand, w.spawn("button") says something about the genealogy of the button. It says it's the spawn of the window, and therefore belongs _somewhere_ in the window's hierarchy tree. Not necessarily as the direct child of the window. I should point out that that windows can only contain one widget. However, that widget might be a grid widget. This is an auto-sizing framework.
It seems to me that you're trying to fit two concepts into one box, the widget and its properties. All this jumping through hoops occurs because you're trying to manipulate a "widget that must belong to a window" when in actual fact you're interested only in its properties:
Yes I am trying to fit two concepts into one box, but those aren't the two concepts in question. The sticking point is that the window is both a container of a widget, *and* the factory for all widgets that will ultimately be contained within the window's widget hierarchy. Again, I appeal to the W3C DOM: body = document.createElement("body"); document.appendChild(body); div = document.createElement("div"); body.appendChild(div); Regards David Turner