]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/window.cpp
Fix wxListCtrl background colour bug Part I
[wxWidgets.git] / src / msw / window.cpp
index beec10fa021a3439a3aca01bd9ce3adf8f32986d..77589902e52de74badfdc01b09e54c06d7afcf75 100644 (file)
@@ -2036,10 +2036,18 @@ bool wxWindowMSW::MSWProcessMessage(WXMSG* pMsg)
         }
 #endif // 1/0
 
-        if ( ::IsDialogMessage(GetHwnd(), msg) )
+        // we handle VK_ESCAPE ourselves in wxDialog::OnCharHook() and we
+        // shouldn't let IsDialogMessage() get it as it _always_ eats the
+        // message even when there is no cancel button and when the message is
+        // needed by the control itself: in particular, it prevents the tree in
+        // place edit control from being closed with Escape in a dialog
+        if ( msg->message != WM_KEYDOWN || msg->wParam != VK_ESCAPE )
         {
-            // IsDialogMessage() did something...
-            return TRUE;
+            if ( ::IsDialogMessage(GetHwnd(), msg) )
+            {
+                // IsDialogMessage() did something...
+                return TRUE;
+            }
         }
     }
 #endif // __WXUNIVERSAL__
@@ -2549,18 +2557,8 @@ long wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam
 #endif // VK_APPS
 
                 default:
-                    if ( m_lastKeydownProcessed )
-                    {
-                        // The key was handled in the EVT_KEY_DOWN and handling
-                        // a key in an EVT_KEY_DOWN handler is meant, by
-                        // design, to prevent EVT_CHARs from happening
-                        m_lastKeydownProcessed = FALSE;
-                        processed = TRUE;
-                    }
-                    else // do generate a CHAR event
-                    {
-                        processed = HandleChar((WORD)wParam, lParam);
-                    }
+                    // do generate a CHAR event
+                    processed = HandleChar((WORD)wParam, lParam);
 
             }
             break;
@@ -2586,7 +2584,18 @@ long wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam
 
         case WM_SYSCHAR:
         case WM_CHAR: // Always an ASCII character
-            processed = HandleChar((WORD)wParam, lParam, TRUE);
+            if ( m_lastKeydownProcessed )
+            {
+                // The key was handled in the EVT_KEY_DOWN and handling
+                // a key in an EVT_KEY_DOWN handler is meant, by
+                // design, to prevent EVT_CHARs from happening
+                m_lastKeydownProcessed = FALSE;
+                processed = TRUE;
+            }
+            else
+            {
+                processed = HandleChar((WORD)wParam, lParam, TRUE);
+            }
             break;
 
         case WM_HSCROLL:
@@ -2646,6 +2655,10 @@ long wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam
             processed = HandlePaletteChanged((WXHWND) (HWND) wParam);
             break;
 
+        case WM_CAPTURECHANGED:
+            processed = HandleCaptureChanged((WXHWND) (HWND) lParam);
+            break;
+
         case WM_QUERYNEWPALETTE:
             processed = HandleQueryNewPalette();
             break;
@@ -3510,6 +3523,14 @@ bool wxWindowMSW::HandlePaletteChanged(WXHWND hWndPalChange)
     return GetEventHandler()->ProcessEvent(event);
 }
 
+bool wxWindowMSW::HandleCaptureChanged(WXHWND hWndGainedCapture)
+{
+    wxMouseCaptureChangedEvent event(GetId(), wxFindWinFromHandle(hWndGainedCapture));
+    event.SetEventObject(this);
+
+    return GetEventHandler()->ProcessEvent(event);
+}
+
 bool wxWindowMSW::HandleQueryNewPalette()
 {