]> git.saurik.com Git - wxWidgets.git/commitdiff
fix for handling TAB presses in readonly text controls
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 7 Sep 2002 18:38:25 +0000 (18:38 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 7 Sep 2002 18:38:25 +0000 (18:38 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@17047 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/textctrl.cpp

index 882a6f60e9fad54fe7799e3f7a48b7673f302c31..319c02499ff04dd779b01283ef5901a6a59f9371 100644 (file)
@@ -1286,26 +1286,35 @@ long wxTextCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
 
     if ( nMsg == WM_GETDLGCODE )
     {
-        // we always want the chars and the arrows
-        long lDlgCode = DLGC_WANTCHARS | DLGC_WANTARROWS;
-
-        // we may have several different cases:
-        // 1. normal case: both TAB and ENTER are used for dialog navigation
-        // 2. ctrl which wants TAB for itself: ENTER is used to pass to the
-        //    next control in the dialog
-        // 3. ctrl which wants ENTER for itself: TAB is used for dialog
-        //    navigation
-        // 4. ctrl which wants both TAB and ENTER: Ctrl-ENTER is used to pass
-        //    to the next control
-
-        // the multiline edit control should always get <Return> for itself
-        if ( HasFlag(wxTE_PROCESS_ENTER) || HasFlag(wxTE_MULTILINE) )
-            lDlgCode |= DLGC_WANTMESSAGE;
-
-        if ( HasFlag(wxTE_PROCESS_TAB) )
-            lDlgCode |= DLGC_WANTTAB;
-
-        lRc |= lDlgCode;
+        if ( IsEditable() )
+        {
+            // we always want the chars and the arrows
+            long lDlgCode = DLGC_WANTCHARS | DLGC_WANTARROWS;
+
+            // we may have several different cases:
+            // 1. normal case: both TAB and ENTER are used for dlg navigation
+            // 2. ctrl which wants TAB for itself: ENTER is used to pass to the
+            //    next control in the dialog
+            // 3. ctrl which wants ENTER for itself: TAB is used for dialog
+            //    navigation
+            // 4. ctrl which wants both TAB and ENTER: Ctrl-ENTER is used to go
+            //    to the next control
+
+            // the multiline edit control should always get <Return> for itself
+            if ( HasFlag(wxTE_PROCESS_ENTER) || HasFlag(wxTE_MULTILINE) )
+                lDlgCode |= DLGC_WANTMESSAGE;
+
+            if ( HasFlag(wxTE_PROCESS_TAB) )
+                lDlgCode |= DLGC_WANTTAB;
+
+            lRc |= lDlgCode;
+        }
+        else // !editable
+        {
+            // when the control can't be edited by user, it doesn't need any
+            // extra keys at all
+            lRc = 0;
+        }
     }
 
     return lRc;