X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/77ffb5937e89927b621128789401db8921fe580f..90af251453884b7dab2a353280b9061a3ac02b5e:/src/msw/textctrl.cpp diff --git a/src/msw/textctrl.cpp b/src/msw/textctrl.cpp index 6ea4f14304..6c52d71047 100644 --- a/src/msw/textctrl.cpp +++ b/src/msw/textctrl.cpp @@ -6,7 +6,7 @@ // Created: 04/01/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart -// Licence: wxWidgets licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// // ============================================================================ @@ -461,7 +461,12 @@ WXDWORD wxTextCtrl::MSWGetStyle(long style, WXDWORD *exstyle) const if ( style & wxTE_DONTWRAP ) { // automatically scroll the control horizontally as necessary - msStyle |= WS_HSCROLL; + // + // NB: ES_AUTOHSCROLL is needed for richedit controls or they don't + // show horz scrollbar at all, even in spite of WS_HSCROLL, and as + // it doesn't seem to do any harm for plain edit controls, add it + // always + msStyle |= WS_HSCROLL | ES_AUTOHSCROLL; } if ( style & wxTE_READONLY ) @@ -1689,11 +1694,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 +1708,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; } @@ -1923,7 +1932,7 @@ bool wxTextCtrl::AcceptsFocus() const wxSize wxTextCtrl::DoGetBestSize() const { int cx, cy; - wxGetCharSize(GetHWND(), &cx, &cy, &GetFont()); + wxGetCharSize(GetHWND(), &cx, &cy, GetFont()); int wText = DEFAULT_ITEM_WIDTH;