Changed value setting code in ctor and function SetValue so that widget uses a copy of the source string rather than a pointer to the source string. This fixes problems with wxGrid.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3490 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
b164fb385a
commit
b86de524c7
@ -168,8 +168,21 @@ bool wxTextCtrl::Create(wxWindow *parent,
|
||||
}
|
||||
|
||||
if ( !!value )
|
||||
{
|
||||
#if 0
|
||||
// don't do this because it is just linking the text to a source
|
||||
// string which is unsafe. MB
|
||||
//
|
||||
XmTextSetString ((Widget) m_mainWidget, (char*)value.c_str());
|
||||
|
||||
#else
|
||||
// do this instead... MB
|
||||
//
|
||||
XtVaSetValues( (Widget) m_mainWidget,
|
||||
XmNvalue, (char *)value.c_str(),
|
||||
NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
// install callbacks
|
||||
XtAddCallback((Widget) m_mainWidget, XmNvalueChangedCallback, (XtCallbackProc)wxTextWindowChangedProc, (XtPointer)this);
|
||||
|
||||
@ -234,7 +247,18 @@ void wxTextCtrl::SetValue(const wxString& value)
|
||||
{
|
||||
m_inSetValue = TRUE;
|
||||
|
||||
#if 0
|
||||
// don't do this because it is just linking the text to a source
|
||||
// string which is unsafe. MB
|
||||
//
|
||||
XmTextSetString ((Widget) m_mainWidget, (char*)value.c_str());
|
||||
#else
|
||||
// do this instead... MB
|
||||
//
|
||||
XtVaSetValues( (Widget) m_mainWidget,
|
||||
XmNvalue, (char *)value.c_str(),
|
||||
NULL);
|
||||
#endif
|
||||
|
||||
m_inSetValue = FALSE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user