haxeui / haxeui-html5

The HTML5 backend of the HaxeUI framework -
http://haxeui.org
MIT License
28 stars 14 forks source link

Cant add components without using Screen #26

Closed ianharrigan closed 4 years ago

ianharrigan commented 7 years ago

When trying to add components by using the .element property and appending them to an existing <div/> the components are never considered "ready" and therefore never resize, or show correctly.

Expected Behavior

Should be able to add a UI anywhere in the DOM tree and it all work as expected.

Test app / minimal test case

class Main {
    static public function main() {
        haxe.ui.Toolkit.init();

        var main = new VBox();

        var button1 = new Button();
        button1.text = "Button 1";
        main.addComponent(button1);

        var button2 = new Button();
        button2.text = "Button 2";
        main.addComponent(button2);

        js.Browser.document.getElementById("content").appendChild(main.element);
    }
}