]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/window.cpp
added a check which should prevent the crash of bug 555111
[wxWidgets.git] / src / msw / window.cpp
index b99b966f66475765a73c88daeb5798fcbd0bf56e..b280a33098d47c35150332330f61e11ada4a571c 100644 (file)
@@ -1995,9 +1995,23 @@ bool wxWindowMSW::MSWProcessMessage(WXMSG* pMsg)
 
                                 return TRUE;
                             }
-                            //else: no default button
+                            else // no default button
+                            {
 #endif // wxUSE_BUTTON
-                            // treat Enter as TAB: pass to the next control
+                                // this is a quick and dirty test for a text
+                                // control
+                                if ( !(lDlgCode & DLGC_HASSETSEL) )
+                                {
+                                    // don't process Enter, the control might
+                                    // need it for itself and don't let
+                                    // ::IsDialogMessage() have it as it can
+                                    // eat the Enter events sometimes
+                                    return FALSE;
+                                }
+                                //else: treat Enter as TAB: pass to the next
+                                //      control as this is the best thing to do
+                                //      if the text doesn't handle Enter itself
+                            }
                         }
                     }
                     break;
@@ -2407,9 +2421,15 @@ long wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam
                         y = GET_Y_LPARAM(lParam);
 
                     // redirect the event to a static control if necessary
-                    wxWindow *win = FindWindowForMouseEvent(this, &x, &y);
-
-                    processed = win->HandleMouseEvent(message, x, y, wParam);
+                    if (this == GetCapture())
+                    {
+                        processed = HandleMouseEvent(message, x, y, wParam);
+                    }
+                    else
+                    {
+                        wxWindow *win = FindWindowForMouseEvent(this, &x, &y);
+                        processed = win->HandleMouseEvent(message, x, y, wParam);
+                    }
                 }
             }
             break;