]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/textctrl.cpp
Preserve previous state of sizers.
[wxWidgets.git] / src / os2 / textctrl.cpp
index 9efd84b6e8c1700531e3699a010f5aa4261faf74..e4b53da39162d309ad0a3cba656860a01971d634 100644 (file)
@@ -101,9 +101,6 @@ bool wxTextCtrl::Create(
 , const wxString&                   rsName
 )
 {
-    HWND                            hParent;
-    int                             nTempy;
-
     //
     // Base initialization
     //
@@ -607,8 +604,6 @@ void wxTextCtrl::Replace(
 {
 #if wxUSE_CLIPBOARD
     HWND                            hWnd      = GetHwnd();
-    long                            lFromChar = lFrom;
-    long                            lToChar   = lTo;
 
     //
     // Set selection and remove it
@@ -645,8 +640,6 @@ void wxTextCtrl::Remove(
 )
 {
     HWND                            hWnd      = GetHwnd();
-    long                            lFromChar = lFrom;
-    long                            lToChar   = lTo;
 
     if (m_bIsMLE)
     {
@@ -670,7 +663,7 @@ void wxTextCtrl::SetSelection(
     long                            lToChar = lTo;
 
     //
-    // If from and to are both -1, it means (in wxWindows) that all text should
+    // If from and to are both -1, it means (in wxWidgets) that all text should
     // be selected. Translate into Windows convention
     //
     if ((lFrom == -1L) && (lTo == -1L))
@@ -712,7 +705,11 @@ bool wxTextCtrl::IsModified() const
 
 void wxTextCtrl::MarkDirty()
 {
-    wxFAIL_MSG( _T("not implemented") );
+    if (m_bIsMLE)
+        ::WinSendMsg(GetHwnd(), MLM_SETCHANGED, MPFROMLONG(TRUE), 0);
+    else
+        // EM controls do not have a SETCHANGED, what can we do??
+        wxFAIL_MSG( _T("not implemented") );
 }
 
 //
@@ -745,7 +742,6 @@ long wxTextCtrl::XYToPosition(
 , long                              lY
 ) const
 {
-    HWND                            hWnd = GetHwnd();
     long                            lCharIndex = 0L;
     long                            lLen;
 
@@ -1008,7 +1004,6 @@ WXHBRUSH wxTextCtrl::OnCtlColor(
 )
 {
     HPS                             hPS = (HPS)hWxDC;
-    wxBrush*                        pBrush = NULL;
     wxColour                        vColBack = GetBackgroundColour();
     wxColour                        vColFore = GetForegroundColour();
     wxBrush*                        pBackgroundBrush = wxTheBrushList->FindOrCreateBrush( GetBackgroundColour()
@@ -1043,7 +1038,7 @@ void wxTextCtrl::OnChar(
   wxKeyEvent&                       rEvent
 )
 {
-    switch (rEvent.KeyCode())
+    switch (rEvent.GetKeyCode())
     {
         case WXK_RETURN:
             if ( !(m_windowStyle & wxTE_MULTILINE) )
@@ -1150,10 +1145,11 @@ void wxTextCtrl::AdjustSpaceLimit()
     }
     else
     {
-        ENTRYFDATA*                 pEfd;
+        ENTRYFDATA                  Efd;
         WNDPARAMS                   vParams;
 
         vParams.fsStatus = WPM_CBCTLDATA;
+       vParams.pCtlData = &Efd;
         vParams.cbCtlData = sizeof(ENTRYFDATA);
 
         if (::WinSendMsg( GetHwnd()
@@ -1161,10 +1157,7 @@ void wxTextCtrl::AdjustSpaceLimit()
                          ,&vParams
                          ,0
                         ))
-        {
-            pEfd = (ENTRYFDATA*)vParams.pCtlData;
-            uLimit = (unsigned int)pEfd->cchEditLimit;
-        }
+            uLimit = (unsigned int)Efd.cchEditLimit;
         else
             uLimit = 32; //PM's default
     }
@@ -1178,7 +1171,7 @@ void wxTextCtrl::AdjustSpaceLimit()
         if (m_bIsMLE)
             ::WinSendMsg(GetHwnd(), MLM_SETTEXTLIMIT, MPFROMLONG(uLimit), 0);
         else
-            ::WinSendMsg(GetHwnd(), EM_SETTEXTLIMIT, MPFROMLONG(uLimit), 0);
+            ::WinSendMsg(GetHwnd(), EM_SETTEXTLIMIT, MPFROMSHORT(uLimit), 0);
     }
 } // end of wxTextCtrl::AdjustSpaceLimit
 
@@ -1200,7 +1193,7 @@ wxSize wxTextCtrl::DoGetBestSize() const
     wxGetCharSize(GetHWND(), &nCx, &nCy, (wxFont*)&GetFont());
 
     int                             wText = DEFAULT_ITEM_WIDTH;
-    int                             hText = (EDIT_HEIGHT_FROM_CHAR_HEIGHT(nCy) * .8);
+    int                             hText = (int)(EDIT_HEIGHT_FROM_CHAR_HEIGHT(nCy) * .8);
 
     if (m_windowStyle & wxTE_MULTILINE)
     {