]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/textctrl.cpp
Incorporated src/unix/gsocket.c 1.86 to 1.92 changes (except 1.90 to 1.91
[wxWidgets.git] / src / msw / textctrl.cpp
index c4c015a3df0024bea86a8f923faf61cf37972178..e742baa4b0c8b1fc4bea4c17392ba488018f504d 100644 (file)
@@ -245,12 +245,9 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
 #endif
 
     // base initialization
-    if ( !CreateBase(parent, id, pos, size, style, validator, name) )
+    if ( !CreateControl(parent, id, pos, size, style, validator, name) )
         return FALSE;
 
-    if ( parent )
-        parent->AddChild(this);
-
     // translate wxWin style flags to MSW ones
     WXDWORD msStyle = MSWGetCreateWindowFlags();
 
@@ -461,7 +458,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 )
@@ -1359,7 +1361,7 @@ bool wxTextCtrl::PositionToXY(long pos, long *x, long *y) const
 }
 
 wxTextCtrlHitTestResult
-wxTextCtrl::HitTest(const wxPoint& pt, wxTextCoord *col, wxTextCoord *row) const
+wxTextCtrl::HitTest(const wxPoint& pt, long *posOut) const
 {
     // first get the position from Windows
     LPARAM lParam;
@@ -1438,11 +1440,8 @@ wxTextCtrl::HitTest(const wxPoint& pt, wxTextCoord *col, wxTextCoord *row) const
     else
         rc = wxTE_HT_ON_TEXT;
 
-    // finally translate to column/row
-    if ( !PositionToXY(pos, col, row) )
-    {
-        wxFAIL_MSG( _T("PositionToXY() not expected to fail in HitTest()") );
-    }
+    if ( posOut )
+        *posOut = pos;
 
     return rc;
 }
@@ -1927,7 +1926,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;