escott@eos.ncsu.edu (Erik Scott) (01/31/91)
(Motif 1.1, DEC PMAX (Mips-chip), MIT X11R4 Server) I have a multi-line text widget, called text, that contains a lot of text. I would like to remove this text, so I try this: erik[0]='\0'; XmTextSetInsertionPosition(text,0); XmTextSetString(text, erik); And the text is still there. It has the XmNeditable resc. set to True. Since that didn't work, I tried: XtDestroyWidget(text); ac = 0; XtSetArg (al[ac], XmNrows, 24); ac++; XtSetArg (al[ac], XmNcolumns, 80); ac++; XtSetArg (al[ac], XmNresizeWidth, False); ac++; XtSetArg (al[ac], XmNresizeHeight, False); ac++; XtSetArg (al[ac], XmNscrollVertical, True); ac++; XtSetArg (al[ac], XmNeditMode, XmMULTI_LINE_EDIT); ac++; text = XmCreateScrolledText (parent, "text", al, ac); XtManageChild(text); which did work but is a bit brutal for my tastes (besides, I would have to rewrite a LOT of code to make that work right). What is the 'best' way to remove text from a Text widget? erik scott escott@eos.ncsu.edu
pasturel@sctc.com (Pierre Pasturel) (01/31/91)
escott@eos.ncsu.edu (Erik Scott) writes: >(Motif 1.1, DEC PMAX (Mips-chip), MIT X11R4 Server) >I have a multi-line text widget, called text, that contains a lot >of text. I would like to remove this text, so I try this: > erik[0]='\0'; > XmTextSetInsertionPosition(text,0); > XmTextSetString(text, erik); To clear a text, I simply do XmTextSetString( text_widget, "" ), although I don't see how this is different from yours. I also have learned to do a few XFlush()'s when I want to make sure the text gets refreshed immediately in a callback, followed by an XmUpdateDisplay() call. >And the text is still there. It has the XmNeditable resc. set to True. This should not matter. Setting it to TRUE simpley allows the User to edit the text. The application should always be able to as far as I know. >erik scott escott@eos.ncsu.edu Pierre pasturel@sctc.com