fixed handling of the accelerators of menu items added to already attached submenus

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34869 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2005-07-16 22:29:47 +00:00
parent 62d5b1ceb7
commit 99f0dc6887
2 changed files with 11 additions and 0 deletions

View File

@@ -20,6 +20,7 @@ wxMSW:
- Separators are now correctly shown in the toolbars under Windows XP - Separators are now correctly shown in the toolbars under Windows XP
- Fixed multiline tooltips handling. - Fixed multiline tooltips handling.
- Fixed wxSlider::GetSelEnd() (Atilim Cetin) - Fixed wxSlider::GetSelEnd() (Atilim Cetin)
- Fixed accelerators of menu items added to already attached submenus
wxUniv: wxUniv:

View File

@@ -305,6 +305,16 @@ void wxMenu::UpdateAccel(wxMenuItem *item)
} }
else if ( !item->IsSeparator() ) else if ( !item->IsSeparator() )
{ {
// recurse upwards: we should only modify m_accels of the top level
// menus, not of the submenus as wxMenuBar doesn't look at them
// (alternative and arguable cleaner solution would be to recurse
// downwards in GetAccelCount() and CopyAccels())
if ( GetParent() )
{
GetParent()->UpdateAccel(item);
return;
}
// find the (new) accel for this item // find the (new) accel for this item
wxAcceleratorEntry *accel = wxGetAccelFromString(item->GetText()); wxAcceleratorEntry *accel = wxGetAccelFromString(item->GetText());
if ( accel ) if ( accel )