[comp.windows.x] XtTextReplace call

billd@Apple.COM (William Dorsey) (08/05/88)

Has anyone gotten the XtTextReplace call to work?  I've set up a text widget
with an initial string to display, and then tried the XtTextReplace call to
update the string, but I repeatedly get segmentation faults.  I've tried
many combinations, but to no avail.  Any hints or suggestions would be
appreciated.

Here is the relevant code:

----------------------------------------------------
XtTextBlock wtext;

void callback(w, client_data, call_data)
    Widget w;
    caddr_t client_data, call_data;
{
    wtext.firstPos = 0;
    wtext.str = "hello";
    wtext.length = strlen(wtext.str);
    XtTextReplace(w, (XtTextPosition) 0, (XtTextPosition) strlen(init_msg)-1,
                  wtext);
}
----------------------------------------------------

Basically, I want to replace the existing text in the widget with a new
string.  Thus I am specifying the beginning and ending locations of the old
string as the first and last characters to be replaced.  Is this correct?
Thanks in advance,

Bill Dorsey    billd@apple.com