Search code examples
wxwidgetssubmenu

Submenu of a wxMenuItem


I wanted to have a submenu manually append to a submenu("History") under "Edit"

wxMenuBar * menubara = GetMenuBar();
wxMenu * menua = menubara->GetMenu(1);
wxInt32 menuIda = menua->FindItem(wxT("History"));    
wxMenuItem * menuItema = menua->FindItem(menuIda); 

This is how I get History as a wxMenuItem. However, there is no addSubMenu for wxMenuItem. How can I add a submenu to History?


Solution

  • From my memory, so I might be wrong: you have to create another menu (if it does not already have it, get it with GetSubMenu), insert a new menu item for the new entry and use wxMenuItem->SetSubMenu to set it.