]> git.saurik.com Git - wxWidgets.git/commitdiff
Don't pass spin text control messages processed at wx level to Windows.
authorVadim Zeitlin <vadim@wxwidgets.org>
Fri, 22 Jul 2011 12:49:24 +0000 (12:49 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Fri, 22 Jul 2011 12:49:24 +0000 (12:49 +0000)
Windows messages handled at wx level shouldn't be processed again at Windows
level but we always passed the events forwarded by spin control "buddy" text
window to its default window proc as we had no way to determine whether they
were really handled or not.

Now we do have a way to do, by using the newly added MSWHandleMessage(), so
only pass the messages to default window proc if they hadn't been handled
already.

This notably suppresses the annoying beep which happened if Enter key was
pressed in a wxSpinCtrl with wxTE_PROCESS_ENTER style (as used by the
corresponding wxDataViewCtrl renderer, for example). It probably corrects some
other bugs/discrepancies with the other ports in event handling in wxSpinCtrl
too.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68328 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/spinctrl.cpp

index 19e302e6d498fa589189b91ababeb7d454144c25..6cc84eac58138af1991eb4583a8fdb37dd7c8612 100644 (file)
@@ -119,11 +119,21 @@ LRESULT APIENTRY _EXPORT wxBuddyTextWndProc(HWND hwnd,
         // is clicked with the "?" cursor
         case WM_HELP:
 #endif
-            spin->MSWWindowProc(message, wParam, lParam);
-
-            // The control may have been deleted at this point, so check.
-            if ( !::IsWindow(hwnd) )
-                return 0;
+            {
+                WXLRESULT result;
+                if ( spin->MSWHandleMessage(&result, message, wParam, lParam) )
+                {
+                    // Do not let the message be processed by the window proc
+                    // of the text control if it had been already handled at wx
+                    // level, this is consistent with what happens for normal,
+                    // non-composite controls.
+                    return 0;
+                }
+
+                // The control may have been deleted at this point, so check.
+                if ( !::IsWindow(hwnd) )
+                    return 0;
+            }
             break;
 
         case WM_GETDLGCODE: