Can i use file menu.hx in folder containers/menu/..?

haxeui-core
#1

On the new-component-method… File menu.hx in folder containers/menu/…, Can i use it.? Thanks

#2

Hi!

The menu system in new-component-method branch is currently work in progress, but it can be used. However, at the moment (and this will be changed shortly) you can only have top level menus, eg:

<menubar width="100%">
    <menu text="File">
        <menuitem text="Item 1" />
        <menu text="Sub Menu">
            <menuitem text="Item 1" />
            <menuitem text="Item 2" />
            <menuitem text="Item 3" />
            <menuseparator />
            <menucheckbox text="Item 4" />
            <menucheckbox text="Item 5" />
            <menucheckbox text="Item 6" />
            <menuseparator />
            <menuoptionbox text="Item 7" />
            <menuoptionbox text="Item 8" />
            <menuoptionbox text="Item 9" />
        </menu>
    </menu>
    <menu text="Edit">
        <menuitem text="Item 1" />
    </menu>
    <menu text="Help">
        <menuitem text="Item 1" />
    </menu>
</menubar>

image

So this means currently you have to use menubar to contain all your menus. Eventually this will be extended to standalone menus (for example), on right click.

Were you thinking about using with a menubar or, for example, with a right click?

Cheers,
Ian

#3

it mean i can extend menu from haxe.ui.containers.menu.Menu ?
i usually extend like this …
image

#4

You should be able to, its just a normal haxeui component. I mean, things like this should also work:

class MySpecialMenu extends Menu {
    public function new() {
        addComponent(new MenuItem()).text = "Item 1";
        addComponent(new MenuItem()).text = "Item 2";
        addComponent(new MenuItem()).text = "Item 3";
    }
}
<menubar width="100%">
    <myspecialmenu />
</menubar>

Note: If you want to use the class via xml in this way then you must also register it in a module.xml - but thats probably out of scope for this question.

Im not sure if that is exactly what you are asking? If not might need a few more details of exactly what it is you are trying to do.

Cheers,
Ian

1 Like
#5

Thank you so much… i solved my problem,:+1: