Menu with 3 level

  • 5 Replies
  • 203 Views
Menu with 3 level
« on: 04 April 2019, 10:47:27 »
Hello all,

I try to make a menu with 3 level ... Like  File>save>File or File>save>backup.

Tgui avec menu and item menu but i dont found the solution for my problem.

Sorry for my english ;)

Re: Menu with 3 level
« Reply #1 on: 04 April 2019, 16:55:21 »
Hi

do something like that:

Code: [Select]
menu->addMenuItem({ "File", "Save", "Backup" });

Re: Menu with 3 level
« Reply #2 on: 08 April 2019, 11:28:09 »
Ok, it's good to add a item... but how i do to link an action ?

I Try :
MenuBar1->connectMenuItem("File",{"File", "backup", "Action 1"},fonction1,arg);  Doesn't work
MenuBar1->connectMenuItem({"File", "backup"},"Action 1",fonction1,arg); Doesn't work
MenuBar1->connectMenuItem("File","Action 1",fonction1,arg); Doesn't work
MenuBar1->connectMenuItem("backup","Action 1",fonction1,arg); Doesn't work

I'm Loose


Re: Menu with 3 level
« Reply #3 on: 08 April 2019, 12:09:53 »
One way is this
Code: [Select]
void CALLBACK menuBarClicked(tgui::MenuBar::Ptr /*menu*/)
{
// backup clicked
}
MenuBar1->connectMenuItem({ "File", "Save", "Backup" }, &menuBarClicked, MenuBar1);

or alternatively

Code: [Select]
MenuBar1->connectMenuItem({ "File", "Save", "Backup" }, [&]()
{
// backup clicked
});



Re: Menu with 3 level
« Reply #4 on: 08 April 2019, 12:13:30 »
Ok thx, i will try this
thanks.

Re: Menu with 3 level
« Reply #5 on: 08 April 2019, 13:47:46 »
 ;D It's work !! Thanks