]> git.saurik.com Git - wxWidgets.git/blobdiff - src/motif/textctrl.cpp
Move per display data cleanup to wxApp::CleanUp where it belongs.
[wxWidgets.git] / src / motif / textctrl.cpp
index b604bab9e4d8955a282b1e60c95cb718f333fecf..52867950ee2d18b4402eb05c843597c6ecfccef4 100644 (file)
@@ -196,12 +196,8 @@ bool wxTextCtrl::Create(wxWindow *parent,
     // font
     ChangeFont(false);
 
-    wxSize best = GetBestSize();
-    if( size.x != -1 ) best.x = size.x;
-    if( size.y != -1 ) best.y = size.y;
-
     AttachWidget (parent, m_mainWidget, (WXWidget) NULL,
-                  pos.x, pos.y, best.x, best.y);
+                  pos.x, pos.y, size.x, size.y);
 
     ChangeBackgroundColour();
 
@@ -392,7 +388,7 @@ void wxTextCtrl::SetSelection(long from, long to)
 
 void wxTextCtrl::WriteText(const wxString& text)
 {
-    long textPosition = GetInsertionPoint() + strlen (text);
+    long textPosition = GetInsertionPoint() + text.length();
     XmTextInsert ((Widget) m_mainWidget, GetInsertionPoint(),
                   wxConstCast(text.c_str(), char));
     XtVaSetValues ((Widget) m_mainWidget, XmNcursorPosition, textPosition, NULL);
@@ -683,7 +679,13 @@ wxSize wxDoGetSingleTextCtrlBestSize( Widget textWidget,
 wxSize wxTextCtrl::DoGetBestSize() const
 {
     if( IsSingleLine() )
-        return wxDoGetSingleTextCtrlBestSize( (Widget)m_mainWidget, this );
+    {
+        wxSize best = wxControl::DoGetBestSize();
+
+        if( best.x < 110 ) best.x = 110;
+
+        return best;
+    }
     else
         return wxWindow::DoGetBestSize();
 }