Ticket #17678: popupmenu-helptext.patch

File popupmenu-helptext.patch, 2.1 KB (added by troelsk, 4 years ago)
  • samples/menu/menu.cpp

     samples/menu/menu.cpp   | 4 ++--
     src/common/framecmn.cpp | 9 ++++++++-
     2 files changed, 10 insertions(+), 3 deletions(-)
    
    diff --git a/samples/menu/menu.cpp b/samples/menu/menu.cpp
    index 1b382f6..e63d43a 100644
    a b MyFrame::MyFrame() 
    532532
    533533#if USE_LOG_WINDOW
    534534    wxMenuItem *item = new wxMenuItem(fileMenu, Menu_File_ClearLog,
    535                                       wxT("Clear &log\tCtrl-L"));
     535                                      wxT("Clear &log\tCtrl-L"), "HELPTEXT");
    536536    item->SetBitmap(copy_xpm);
    537537    fileMenu->Append(item);
    538538    fileMenu->AppendSeparator();
    void MyFrame::ShowContextMenu(const wxPoint& pos) 
    11861186        menu.Append(Menu_Help_About, wxT("&About"));
    11871187        menu.Append(Menu_Popup_Submenu, wxT("&Submenu"), CreateDummyMenu(NULL));
    11881188        menu.Append(Menu_Popup_ToBeDeleted, wxT("To be &deleted"));
    1189         menu.AppendCheckItem(Menu_Popup_ToBeChecked, wxT("To be &checked"));
     1189        menu.AppendCheckItem(Menu_Popup_ToBeChecked, wxT("To be &checked"), wxT("HELPTEXT"));
    11901190        menu.Append(Menu_Popup_ToBeGreyed, wxT("To be &greyed"),
    11911191                    wxT("This menu item should be initially greyed out"));
    11921192        menu.AppendSeparator();
  • src/common/framecmn.cpp

    diff --git a/src/common/framecmn.cpp b/src/common/framecmn.cpp
    index fee0c1b..9841e1a 100644
    a b void wxFrameBase::PopStatusText(int number) 
    431431    m_frameStatusBar->PopStatusText(number);
    432432}
    433433
     434extern wxMenu* wxCurrentPopupMenu;
     435
    434436bool wxFrameBase::ShowMenuHelp(int menuId)
    435437{
    436438#if wxUSE_MENUS
    bool wxFrameBase::ShowMenuHelp(int menuId) 
    440442    wxString helpString;
    441443    if ( menuId != wxID_SEPARATOR && menuId != wxID_NONE )
    442444    {
    443         const wxMenuItem * const item = FindItemInMenuBar(menuId);
     445        const wxMenuItem* item = NULL;
     446
     447        if (wxCurrentPopupMenu)
     448            item = wxCurrentPopupMenu->FindItem(menuId);
     449        if (item == NULL)
     450            item = FindItemInMenuBar(menuId);
    444451        if ( item && !item->IsSeparator() )
    445452            helpString = item->GetHelp();
    446453