TGUI Forum
General Category => General Discussion => Topic started by: asuchi 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 ;)
-
Hi
do something like that:
menu->addMenuItem({ "File", "Save", "Backup" });
-
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
-
One way is this
void CALLBACK menuBarClicked(tgui::MenuBar::Ptr /*menu*/)
{
// backup clicked
}
MenuBar1->connectMenuItem({ "File", "Save", "Backup" }, &menuBarClicked, MenuBar1);
or alternatively
MenuBar1->connectMenuItem({ "File", "Save", "Backup" }, [&]()
{
// backup clicked
});
-
Ok thx, i will try this
thanks.
-
;D It's work !! Thanks