]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/textctrl.cpp
don't use assert dialog under wxDFB, it does more harm than good
[wxWidgets.git] / src / os2 / textctrl.cpp
index 111a63165bd0edd45d4dcec0ddd621b70d2cecd4..88178bf957947bd4658105e7e3c7dd0390f10e8d 100644 (file)
@@ -160,7 +160,7 @@ bool wxTextCtrl::Create(
     {
         m_hWnd = (WXHWND)::WinCreateWindow( (HWND)GetHwndOf(pParent) // Parent window handle
                                            ,WC_MLE                   // Window class
-                                           ,(PSZ)rsValue.c_str()     // Initial Text
+                                           ,rsValue.c_str()     // Initial Text
                                            ,(ULONG)lSstyle           // Style flags
                                            ,(LONG)0                  // X pos of origin
                                            ,(LONG)0                  // Y pos of origin
@@ -177,7 +177,7 @@ bool wxTextCtrl::Create(
     {
         m_hWnd = (WXHWND)::WinCreateWindow( (HWND)GetHwndOf(pParent) // Parent window handle
                                            ,WC_ENTRYFIELD            // Window class
-                                           ,(PSZ)rsValue.c_str()     // Initial Text
+                                           ,rsValue.c_str()     // Initial Text
                                            ,(ULONG)lSstyle           // Style flags
                                            ,(LONG)0                  // X pos of origin
                                            ,(LONG)0                  // Y pos of origin
@@ -329,7 +329,8 @@ void wxTextCtrl::SetupColours()
 wxString wxTextCtrl::GetValue() const
 {
     wxString                        sStr = wxGetWindowText(GetHWND());
-    char*                           zStr = (char*)sStr.c_str();
+    wxCharBuffer                    buf(sStr.char_str());
+    char*                           zStr = buf.data();
 
     for ( ; *zStr; zStr++ )
     {
@@ -341,7 +342,7 @@ wxString wxTextCtrl::GetValue() const
         if (*zStr == '\r')
             *zStr = '\n';
     }
-    return sStr;
+    return zStr;
 } // end of wxTextCtrl::GetValue
 
 void wxTextCtrl::DoSetValue(
@@ -360,7 +361,7 @@ void wxTextCtrl::DoSetValue(
         if ( flags & SetValue_SendEvent )
             m_bSkipUpdate = true;
 
-        ::WinSetWindowText(GetHwnd(), (PSZ)rsValue.c_str());
+        ::WinSetWindowText(GetHwnd(), rsValue.c_str());
         AdjustSpaceLimit();
     }
 } // end of wxTextCtrl::SetValue
@@ -370,9 +371,9 @@ void wxTextCtrl::WriteText(
 )
 {
     if (m_bIsMLE)
-        ::WinSendMsg(GetHwnd(), MLM_INSERT, MPARAM((PCHAR)rsValue.c_str()), MPARAM(0));
+        ::WinSendMsg(GetHwnd(), MLM_INSERT, MPARAM(rsValue.wx_str()), MPARAM(0));
     else
-        ::WinSetWindowText(GetHwnd(), (PSZ)rsValue.c_str());
+        ::WinSetWindowText(GetHwnd(), rsValue.c_str());
     AdjustSpaceLimit();
 } // end of wxTextCtrl::WriteText
 
@@ -1048,7 +1049,7 @@ void wxTextCtrl::OnChar(
                 wxCommandEvent      vEvent(wxEVT_COMMAND_TEXT_ENTER, m_windowId);
 
                 vEvent.SetEventObject(this);
-                if ( GetEventHandler()->ProcessEvent(vEvent))
+                if ( HandleWindowEvent(vEvent))
                     return;
             }
             //else: multiline controls need Enter for themselves
@@ -1070,7 +1071,7 @@ void wxTextCtrl::OnChar(
                 vEventNav.SetWindowChange(false);
                 vEventNav.SetEventObject(this);
 
-                if ( GetEventHandler()->ProcessEvent(vEventNav) )
+                if ( HandleWindowEvent(vEventNav) )
                     return;
             }
             break;
@@ -1094,7 +1095,7 @@ bool wxTextCtrl::OS2Command(
                                           );
 
                 vEvent.SetEventObject(this);
-                GetEventHandler()->ProcessEvent(vEvent);
+                HandleWindowEvent(vEvent);
             }
             break;
 
@@ -1170,11 +1171,17 @@ void wxTextCtrl::AdjustSpaceLimit()
     }
     if (uLen >= uLimit)
     {
-        uLimit = uLen + 0x8000;    // 32Kb
-        if (uLimit > 0xffff)
+        if (m_bIsMLE)
         {
-            uLimit = 0L;
+            uLimit = uLen + 0x8000;    // 32Kb
+            if (uLimit > 0xffff)
+            {
+                uLimit = 0L;
+            }
         }
+        else
+            uLimit = 0x7fff;
+
         if (m_bIsMLE)
             ::WinSendMsg(GetHwnd(), MLM_SETTEXTLIMIT, MPFROMLONG(uLimit), 0);
         else