简体   繁体   中英

Adding Menu and Submenu options to Window Menu in MAC using wXwidget C++

Hi I am new to Mac using wxWidget. I need to add a sub menu and some menu items under the Window Menu on MAC. I am able to do same for Window menu on PC but not on MAC.

Also, I am not getting event for click on Window Menu to the function attached with EVT_MENU_OPEN event.

Please help.

I don't really understand the question clearly. However you may have to do something like this for a menu on mac.

    m_menuBar = new wxMenuBar();
#if defined(__WXMAC__)  
    m_menuBar->SetAppleMenuItemLabel(wxApp::s_macAboutMenuItemId, wxT("About"));
    m_menuBar->SetAppleMenuItemLabel(wxApp::s_macWindowMenuItemId, wxT("Window"));
    m_menuBar->SetAppleMenuItemLabel(wxApp::s_macExitMenuItemId, wxT("Quit"));
#endif  

where s_macAboutMenuItemId, s_macWindowMenuItemId, s_macExitMenuItemId are your respective menu ids defined.

and regarding not getting event for click on Window Menu to the function attached with EVT_MENU_OPEN event, check if you have correct entries(Menu id, corresponding function name) in the declared event table.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM