haxeui / haxeui-hxwidgets

The hxWidgets backend of the HaxeUI framework -
http://haxeui.org
MIT License
23 stars 7 forks source link

to be able to set selectedItem #35

Closed Shallowmallow closed 1 year ago

Shallowmallow commented 1 year ago

Now , something like this will work even though it's not perfect


@:xml('
<vbox width="100%" height="100%">
        <dropdown id="dropdown" text="Select Item">
            <data>
                <item text="Item 1" />
                <item text="Item 2" />
                <item text="Item 3" />
                <item text="Item 4" />
            </data>
        </dropdown>
</vbox>')
class A007 extends VBox {

    public function new() {

        super();

        dropdown.selectedItem = {text:"Item 3"};
        trace(dropdown.selectedItem); // this doesn't work
        dropdown.registerEvent(UIEvent.READY, function f(e) {
            trace(dropdown.selectedItem); // this works
        }

            );
    }

}
ianharrigan commented 1 year ago

So ive come up with a slightly different way to do it, so now you can do:

        dropdown.selectedItem = "Item 3";
        dropdown.selectedItem = {text:"Item 2"};
        dropdown.selectedItem = {value:"Item 4"};

(you should also be able to get the selectedItem without the component being "ready" now also)

Shallowmallow commented 1 year ago

Great ! Already using it :) Thanks !

Le mer. 28 déc. 2022 à 17:33, Ian Harrigan @.***> a écrit :

So ive come up with a slightly different way to do it, so now you can do:

    dropdown.selectedItem = "Item 3";
    dropdown.selectedItem = {text:"Item 2"};
    dropdown.selectedItem = {value:"Item 4"};

(you should also be able to get the selectedItem without the component being "ready" now also)

— Reply to this email directly, view it on GitHub https://github.com/haxeui/haxeui-hxwidgets/pull/35#issuecomment-1366777068, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADBNBIVSXPCFE6EDMTMYUWDWPRTV3ANCNFSM6AAAAAATLKIZ4U . You are receiving this because you authored the thread.Message ID: @.***>