]> 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 c633426aba86b02b789e1ae7e00df00431c32d75..b280a33098d47c35150332330f61e11ada4a571c 100644 (file)
@@ -1996,12 +1996,21 @@ bool wxWindowMSW::MSWProcessMessage(WXMSG* pMsg)
                                 return TRUE;
                             }
                             else // no default button
-#endif // wxUSE_BUTTON
                             {
-                                // no special function for enter and don't even
-                                // let IsDialogMessage() have it: it seems to
-                                // do something really strange with it
-                                return FALSE;
+#endif // wxUSE_BUTTON
+                                // 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
                             }
                         }
                     }
@@ -2412,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;