[comp.windows.x] Setting the Selection in a TextWidget

goddard@aic.hrl.hac.com (10/31/89)

Using Xaw:

I am having trouble with selecting text in a newly created
TextWidget of class asciiDiskWidgetClass.  I do an XtTextReplace
to put the text on the screen, then an XtTextSetSelection to
select the text just put on the screen.  The text appears, and
is highlighted.  Then if I move the cursor to a window of another
client (any *other* client) and middle-mouse click (which defaults
to "insert-selection(PRIMARY,CUT_BUFFER0)", I get the following
error message:

	X Toolkit Error: AtomPtr was not initialized

But if I select the same text with the mouse before insertion,
everything is fine, and moreover the problem does not re-occur
after future calls to XtTextSetSelection.  Curiously, the problem
does not occur when I click to insert in another window of the
client that has the selected text.

After poking around in the code, I think the problem is that
some Atom relating to one of the buffers, either primary or cut,
is not created until the first *manual* selection.  My client
does an XtTextSetSelection before any manual selection.  Can anyone
give me an idea as to what I can do about this?

Nigel Goddard