// event tables and other macros
// ----------------------------------------------------------------------------
-IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl, wxControl)
+IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl, wxTextCtrlBase)
-BEGIN_EVENT_TABLE(wxTextCtrl, wxControl)
+BEGIN_EVENT_TABLE(wxTextCtrl, wxTextCtrlBase)
EVT_CHAR(wxTextCtrl::OnChar)
EVT_DROP_FILES(wxTextCtrl::OnDropFiles)
m_windowStyle = lStyle;
m_bIsMLE = false;
+ m_bSkipUpdate = false;
long lSstyle = WS_VISIBLE | WS_TABSTOP;
{
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::SetValue(
- const wxString& rsValue
+void wxTextCtrl::DoSetValue(
+ const wxString& rsValue,
+ int flags
)
{
//
//
if ((rsValue.length() > 0x400) || (rsValue != GetValue()))
{
- ::WinSetWindowText(GetHwnd(), (PSZ)rsValue.c_str());
+ if ( flags & SetValue_SendEvent )
+ m_bSkipUpdate = true;
+
+ ::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(hWnd, EM_SETSEL, MPFROM2SHORT((USHORT)lFromChar, (USHORT)lToChar), (MPARAM)0);
} // end of wxTextCtrl::SetSelection
-bool wxTextCtrl::LoadFile(
- const wxString& rsFile
+bool wxTextCtrl::DoLoadFile(
+ const wxString& rsFile,
+ int fileType
)
{
- if ( wxTextCtrlBase::LoadFile(rsFile) )
+ if ( wxTextCtrlBase::DoLoadFile(rsFile, fileType) )
{
//
// Update the size limit if needed
return true;
}
return false;
-} // end of wxTextCtrl::LoadFile
+} // end of wxTextCtrl::DoLoadFile
bool wxTextCtrl::IsModified() const
{
case EN_CHANGE:
{
+ if (m_bSkipUpdate)
+ {
+ m_bSkipUpdate = false;
+ break;
+ }
+
wxCommandEvent vEvent( wxEVT_COMMAND_TEXT_UPDATED
,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