changed WM_GETDLGCODE handling so that all windows get WM_CHARs by default

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15857 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2002-06-15 15:32:20 +00:00
parent f586fde36c
commit 5a403e3f2a
2 changed files with 22 additions and 6 deletions

View File

@@ -204,6 +204,11 @@ public:
WXFARPROC MSWGetOldWndProc() const { return m_oldWndProc; } WXFARPROC MSWGetOldWndProc() const { return m_oldWndProc; }
void MSWSetOldWndProc(WXFARPROC proc) { m_oldWndProc = proc; } 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 *FindItem(long id) const;
wxWindow *FindItemByHWND(WXHWND hWnd, bool controlOnly = FALSE) const; wxWindow *FindItemByHWND(WXHWND hWnd, bool controlOnly = FALSE) const;

View File

@@ -313,7 +313,7 @@ void wxWindowMSW::Init()
// MSW specific // MSW specific
m_isBeingDeleted = FALSE; m_isBeingDeleted = FALSE;
m_oldWndProc = 0; m_oldWndProc = NULL;
m_useCtl3D = FALSE; m_useCtl3D = FALSE;
m_mouseInWindow = FALSE; m_mouseInWindow = FALSE;
m_lastKeydownProcessed = FALSE; m_lastKeydownProcessed = FALSE;
@@ -991,7 +991,10 @@ void wxWindowMSW::SubclassWin(WXHWND hWnd)
} }
else 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; m_oldWndProc = NULL;
} }
} }
@@ -2525,11 +2528,19 @@ long wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam
#endif // defined(WM_DRAWITEM) #endif // defined(WM_DRAWITEM)
case WM_GETDLGCODE: case WM_GETDLGCODE:
if ( !IsOfStandardClass() )
{
// we always want to get the char events
rc.result = DLGC_WANTCHARS;
if ( GetWindowStyleFlag() & wxWANTS_CHARS ) if ( GetWindowStyleFlag() & wxWANTS_CHARS )
{ {
// want everything: i.e. all keys and WM_CHAR message // in fact, we want everything
rc.result = DLGC_WANTARROWS | DLGC_WANTCHARS | rc.result |= DLGC_WANTARROWS |
DLGC_WANTTAB | DLGC_WANTMESSAGE; DLGC_WANTTAB |
DLGC_WANTALLKEYS;
}
processed = TRUE; processed = TRUE;
} }
//else: get the dlg code from the DefWindowProc() //else: get the dlg code from the DefWindowProc()