]> git.saurik.com Git - wxWidgets.git/commitdiff
always use HWND first in WM_COMMAND handler to avoid mixing the controls with the...
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 2 Dec 2001 00:49:02 +0000 (00:49 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 2 Dec 2001 00:49:02 +0000 (00:49 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12813 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/window.cpp

index bcbc9cfe08870937032b3e3bbb3ddf5c18f8c7c5..02ba75ec1015d9baa1e7b44a3f318761e878fd0f 100644 (file)
@@ -3536,17 +3536,19 @@ bool wxWindowMSW::HandleCommand(WXWORD id, WXWORD cmd, WXHWND control)
 #endif // wxUSE_MENUS_NATIVE
 
     wxWindow *win = NULL;
-    if ( cmd == 0 || cmd == 1 ) // menu or accel - use id
+
+    // first try to find it from HWND - this works even with the broken
+    // programs using the same ids for different controls
+    if ( control )
     {
-        // must cast to a signed type before comparing with other ids!
-        win = FindItem((signed short)id);
+        win = wxFindWinFromHandle(control);
     }
 
-    if ( !win && control )
+    // try the id
+    if ( !win )
     {
-        // find it from HWND - this works even with the broken programs using
-        // the same ids for different controls
-        win = wxFindWinFromHandle(control);
+        // must cast to a signed type before comparing with other ids!
+        win = FindItem((signed short)id);
     }
 
     if ( win )