]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/textctrl.cpp
reset fg/bg colour and font to default if set to wxNullColour/Font
[wxWidgets.git] / src / msw / textctrl.cpp
index 6ea4f143046a12e8fb2751aa85e2eccfe4545ac6..c4c015a3df0024bea86a8f923faf61cf37972178 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     04/01/98
 // RCS-ID:      $Id$
 // Copyright:   (c) Julian Smart
-// Licence:     wxWidgets licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 // ============================================================================
@@ -1689,11 +1689,6 @@ void wxTextCtrl::OnChar(wxKeyEvent& event)
             break;
 
         case WXK_TAB:
-            // always produce navigation event -- even if we process TAB
-            // ourselves the fact that we got here means that the user code
-            // decided to skip processing of this TAB -- probably to let it
-            // do its default job.
-
             // ok, so this is getting absolutely ridiculous but I don't see
             // any other way to fix this bug: when a multiline text control is
             // inside a wxFrame, we need to generate the navigation event as
@@ -1708,15 +1703,24 @@ void wxTextCtrl::OnChar(wxKeyEvent& event)
             // the right thing to do would, of course, be to understand what
             // the hell is IsDialogMessage() doing but this is beyond my feeble
             // forces at the moment unfortunately
-            if ( FindFocus() == this )
+            if ( !(m_windowStyle & wxTE_PROCESS_TAB))
             {
-                wxNavigationKeyEvent eventNav;
-                eventNav.SetDirection(!event.ShiftDown());
-                eventNav.SetWindowChange(event.ControlDown());
-                eventNav.SetEventObject(this);
-
-                if ( GetParent()->GetEventHandler()->ProcessEvent(eventNav) )
-                    return;
+                if ( FindFocus() == this )
+                {
+                    int flags = 0;
+                    if (!event.ShiftDown())
+                        flags |= wxNavigationKeyEvent::IsForward ;
+                    if (event.ControlDown())
+                        flags |= wxNavigationKeyEvent::WinChange ;
+                    if (Navigate(flags))
+                        return;
+                }
+            }
+            else
+            {
+                // Insert tab since calling the default Windows handler
+                // doesn't seem to do it
+                WriteText(wxT("\t"));
             }
             break;
     }