From b86de524c7b9f7d6067305c01c1fb35ad7321ec4 Mon Sep 17 00:00:00 2001 From: Michael Bedward Date: Thu, 26 Aug 1999 04:41:56 +0000 Subject: [PATCH] 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 --- src/motif/textctrl.cpp | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/motif/textctrl.cpp b/src/motif/textctrl.cpp index 224bd0200c..6a2c7a0cb5 100644 --- a/src/motif/textctrl.cpp +++ b/src/motif/textctrl.cpp @@ -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; } -- 2.45.2