]> git.saurik.com Git - wxWidgets.git/commitdiff
use HWND in HandleCommand() to let buggy programs using duplicate ids for controls...
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 15 Jan 2000 00:17:06 +0000 (00:17 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 15 Jan 2000 00:17:06 +0000 (00:17 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5415 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/window.cpp

index b7552a3d6ce1ce6f00c4fa26469fced363bfbeac..56c491347362357e384a8b3fd54227f9eaea1054 100644 (file)
@@ -2982,10 +2982,16 @@ bool wxWindow::HandleCommand(WXWORD id, WXWORD cmd, WXHWND control)
         return popupMenu->MSWCommand(cmd, id);
     }
 
-    // must cast to a signed type before comparing with other ids!
-    wxWindow *win = FindItem((signed short)id);
-    if ( !win )
+    wxWindow *win;
+    if ( cmd == 0 || cmd == 1 ) // menu or accel - use id
     {
+        // must cast to a signed type before comparing with other ids!
+        win = FindItem((signed short)id);
+    }
+    else
+    {
+        // find it from HWND - this works even with the broken programs using
+        // the same ids for different controls
         win = wxFindWinFromHandle(control);
     }