// event tables and other macros
// ----------------------------------------------------------------------------
-IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl, wxTextCtrlBase)
-
BEGIN_EVENT_TABLE(wxTextCtrl, wxTextCtrlBase)
EVT_CHAR(wxTextCtrl::OnChar)
EVT_DROP_FILES(wxTextCtrl::OnDropFiles)
{
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
{
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
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++ )
{
if (*zStr == '\r')
*zStr = '\n';
}
- return sStr;
+ return zStr;
} // end of wxTextCtrl::GetValue
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
)
{
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
::WinSendMsg(GetHwnd(), MLM_SETCHANGED, MPFROMLONG(TRUE), 0);
else
// EM controls do not have a SETCHANGED, what can we do??
- wxFAIL_MSG( _T("not implemented") );
+ wxFAIL_MSG( wxT("not implemented") );
}
//
case WXK_RETURN:
if ( !(m_windowStyle & wxTE_MULTILINE) )
{
- wxCommandEvent vEvent(wxEVT_COMMAND_TEXT_ENTER, m_windowId);
+ wxCommandEvent vEvent(wxEVT_TEXT_ENTER, m_windowId);
vEvent.SetEventObject(this);
- if ( GetEventHandler()->ProcessEvent(vEvent))
+ if ( HandleWindowEvent(vEvent))
return;
}
//else: multiline controls need Enter for themselves
vEventNav.SetWindowChange(false);
vEventNav.SetEventObject(this);
- if ( GetEventHandler()->ProcessEvent(vEventNav) )
+ if ( HandleWindowEvent(vEventNav) )
return;
}
break;
);
vEvent.SetEventObject(this);
- GetEventHandler()->ProcessEvent(vEvent);
+ HandleWindowEvent(vEvent);
}
break;
break;
}
- wxCommandEvent vEvent( wxEVT_COMMAND_TEXT_UPDATED
+ wxCommandEvent vEvent( wxEVT_TEXT
,m_windowId
);
}
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