*

Soul

  • *
  • 11
    • View Profile
menu bar
« on: 12 May 2014, 21:15:53 »
Hey, how i can use the same menu item names in differend menus?
something like this, when
Code: [Select]
    menu->addMenu("File");
    menu->addMenu("Layers");
    menu->addMenu("Tiles");
    menu->addMenu("Objects");
    menu->addMenuItem("File", "Create");
    menu->addMenuItem("File", "Open");
    menu->addMenuItem("File", "Save");
    menu->addMenuItem("File", "Exit");
    menu->addMenuItem("Tiles", "Create");
    menu->addMenuItem("Tiles", "Open");
    menu->addMenuItem("Tiles", "Exit");
    menu->addMenuItem("Objects", "Create");
    menu->addMenuItem("Objects", "Open");
    menu->addMenuItem("Objects", "Exit");
    menu->addMenuItem("Layers", "Tile");
    menu->addMenuItem("Layers", "Object");
    menu->addMenuItem("Layers", "Type");

when i use callback.text=="Open" only the first method will be called

*

texus

  • *****
  • 1143
    • View Profile
    • Texus's Blog
Re: menu bar
« Reply #1 on: 12 May 2014, 23:15:14 »
Quote
when i use callback.text=="Open" only the first method will be called
I'm not sure what you mean with this.

The callback.text=="Open" should succeed for the Open item in the File, Tiles and Objects menus.
In order to identify which menu, you'll have to check callback.index as well (File will be 0, Tiles will be 2 and Objects will be 3).

I never really though that anyone would need the same string in the menu bar, so I never cared to look for a more intuitive way to handle that callback. But I did add the callback.index to make it possible.

*

Soul

  • *
  • 11
    • View Profile
Re: menu bar
« Reply #2 on: 13 May 2014, 13:38:21 »
cool this is exactly that what i needed, thanks :3