+void MyFrame::OnDeleteSubMenu(wxCommandEvent& WXUNUSED(event))
+{
+ wxMenuBar *menubar = GetMenuBar();
+ wxMenu *menu = menubar->GetMenu(menubar->FindMenu("Test"));
+ wxCHECK_RET( menu, wxT("no 'Test' menu?") );
+
+ for ( int n = menu->GetMenuItemCount() - 1; n >=0 ; --n )
+ {
+ wxMenuItem* item = menu->FindItemByPosition(n);
+ if (item->IsSubMenu())
+ {
+ menu->Destroy(item);
+ return;
+ }
+ }
+
+ wxLogWarning(wxT("No submenu to delete!"));
+}
+