diff --git a/src/os2/accel.cpp b/src/os2/accel.cpp index 57744e3706..5cd421d0ff 100644 --- a/src/os2/accel.cpp +++ b/src/os2/accel.cpp @@ -99,11 +99,11 @@ wxAcceleratorTable::wxAcceleratorTable( int i; m_refData = new wxAcceleratorRefData; - pArr = (PACCELTABLE) new int[nAccelLength]; + pArr = (PACCELTABLE) new BYTE[nAccelLength]; for (i = 0; i < n; i++) { - USHORT uVirt = 0; + USHORT uVirt = AF_CHAR; if (vaEntries[i].GetFlags() & wxACCEL_ALT) uVirt |= AF_ALT; @@ -116,7 +116,8 @@ wxAcceleratorTable::wxAcceleratorTable( USHORT uKey = wxCharCodeWXToOS2( vaEntries[i].GetKeyCode() ,&bIsVirtual ); - uVirt |= AF_VIRTUALKEY; + if (bIsVirtual) + uVirt |= AF_VIRTUALKEY; USHORT uCmd = vaEntries[i].GetCommand(); diff --git a/src/os2/menu.cpp b/src/os2/menu.cpp index 5b379f2b3c..e98fe40b14 100644 --- a/src/os2/menu.cpp +++ b/src/os2/menu.cpp @@ -267,15 +267,6 @@ bool wxMenu::DoInsertOrAppend( wxString sError; #if wxUSE_ACCEL UpdateAccel(pItem); - - // - // Ensure the accelerator table is set to the frame (not the client!) - // - if (!::WinSetAccelTable( vHabmain - ,(HWND)pFrame->GetFrame() - ,m_vAccelTable.GetHACCEL() - )) - wxLogLastError("WinSetAccelTable"); #endif // wxUSE_ACCEL // @@ -1017,6 +1008,14 @@ void wxMenuBar::Attach( #if wxUSE_ACCEL RebuildAccelTable(); + // + // Ensure the accelerator table is set to the frame (not the client!) + // + if (!::WinSetAccelTable( vHabmain + ,(HWND)pFrame->GetFrame() + ,m_vAccelTable.GetHACCEL() + )) + wxLogLastError("WinSetAccelTable"); #endif // wxUSE_ACCEL } // end of wxMenuBar::Attach