]> git.saurik.com Git - wxWidgets.git/commitdiff
changed WM_GETDLGCODE handling so that all windows get WM_CHARs by default
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 15 Jun 2002 15:32:20 +0000 (15:32 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 15 Jun 2002 15:32:20 +0000 (15:32 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15857 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/msw/window.h
src/msw/window.cpp

index 1879fef243b2c8cf4843531d3ba214eb3be1c264..cbe843dd7b02a6d0805bd1f18269f166b34b95ca 100644 (file)
@@ -204,6 +204,11 @@ public:
     WXFARPROC MSWGetOldWndProc() const { return m_oldWndProc; }
     void MSWSetOldWndProc(WXFARPROC proc) { m_oldWndProc = proc; }
 
+    // return TRUE if the window is of a standard (i.e. not wxWindows') class
+    //
+    // to understand why does it work, look at SubclassWin() code and comments
+    bool IsOfStandardClass() const { return m_oldWndProc != NULL; }
+
     wxWindow *FindItem(long id) const;
     wxWindow *FindItemByHWND(WXHWND hWnd, bool controlOnly = FALSE) const;
 
index fb4aeded03b366df803a5c73d0cccf57364ec005..24d95786207d7821d12bdb7d9d69f3e908ce9719 100644 (file)
@@ -313,7 +313,7 @@ void wxWindowMSW::Init()
 
     // MSW specific
     m_isBeingDeleted = FALSE;
-    m_oldWndProc = 0;
+    m_oldWndProc = NULL;
     m_useCtl3D = FALSE;
     m_mouseInWindow = FALSE;
     m_lastKeydownProcessed = FALSE;
@@ -991,7 +991,10 @@ void wxWindowMSW::SubclassWin(WXHWND hWnd)
     }
     else
     {
-        // don't bother restoring it neither
+        // don't bother restoring it neither: this also makes it easy to
+        // implement IsOfStandardClass() method which returns TRUE for the
+        // standard controls and FALSE for the wxWindows own windows as it can
+        // simply check m_oldWndProc
         m_oldWndProc = NULL;
     }
 }
@@ -2525,11 +2528,19 @@ long wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam
 #endif // defined(WM_DRAWITEM)
 
         case WM_GETDLGCODE:
-            if ( GetWindowStyleFlag() & wxWANTS_CHARS )
+            if ( !IsOfStandardClass() )
             {
-                // want everything: i.e. all keys and WM_CHAR message
-                rc.result = DLGC_WANTARROWS | DLGC_WANTCHARS |
-                            DLGC_WANTTAB | DLGC_WANTMESSAGE;
+                // we always want to get the char events
+                rc.result = DLGC_WANTCHARS;
+
+                if ( GetWindowStyleFlag() & wxWANTS_CHARS )
+                {
+                    // in fact, we want everything
+                    rc.result |= DLGC_WANTARROWS |
+                                 DLGC_WANTTAB |
+                                 DLGC_WANTALLKEYS;
+                }
+
                 processed = TRUE;
             }
             //else: get the dlg code from the DefWindowProc()