Close menu

Nico Schümann nico at nico22.de
Wed Oct 31 16:06:10 PDT 2007


Hi folks,

I use a menu as a button to close wxNotebook tabs, which actually works.
The tab closes as expected, but the menu itself (which is empty), stays
open, meaning it is blue.
How can I close it? I tried that wxWVT_MENU_CLOSE, but the menu still
stays open.

Could you help me?
Thanks in advantage,

Nico


EVT_MENU_OPEN(MainFrame::OnMenuOpen)
[...]
wxMenu *tabMenu = new wxMenu;
[...]
menuBar->Append(tabMenu, _T(TAB_CLOSE));


void MainFrame::OnMenuOpen(wxMenuEvent& event)
{       if(event.GetMenu()->GetTitle() == _T(TAB_CLOSE))
        {  

                int id;
                if((id = nb->GetSelection()) != wxNOT_FOUND)
                        nb->DeletePage(id);
                wxMenuEvent ev(wxEVT_MENU_CLOSE, this->GetId(),
event.GetMenu());
                ProcessEvent(ev);

        }
}





More information about the wx-users mailing list