[comp.windows.x.motif] Cursors and XmText widgets

richt@meaddata.com (Rich Thompson) (10/10/90)

I would like to place a cursor in a XmText widget when
it loses focus so that the user know where, in the text
widget, he/she was when it was last used.  Is there any
quick and painless way of doing this?  Thanks for any
info anyone can give me.

                                     Rich

---
I bet you were expecting a disclaimer here, weren't you?

whitty@hpcvlx.cv.hp.com (Joe Whitty) (10/17/90)

> / hpcvlx:comp.windows.x.motif / richt@meaddata.com (Rich Thompson) /  8:27 am  Oct 10, 1990 /
> I would like to place a cursor in a XmText widget when
> it loses focus so that the user know where, in the text
> widget, he/she was when it was last used.  Is there any
> quick and painless way of doing this?  Thanks for any
> info anyone can give me.
> 
>                                      Rich

There is an additional cursor in the Motif 1.1 text widget.  It is called
the destination cursor and is displayed as a caret "^".  It marks the
position of the destination selection.  When the destination is at the
same position of the insert cursor and the widget has the focus, only
the blinking I-beam is visible.  When the widget loses focus, the caret
cursor remains at the insertion point.  This cursor has many purposes,
but is mainly used with keyboard selections.

This was not trivial to do and I would not recommend trying to add your
own cursor.  There is alot of overhead associated with the destination
cursor, and it still needs some performance tuning.

If you do decide to add a cursor, you would have to get into the guts
of the text widget to understand how cursor manipulation is being done.
The text widget does some XCopyAreas() and XClearAreas() that could
occlude your cursor drawing.  Also, you would need to be notified if you
started typing elsewhere to delete your cursor.  You could use selections
to do this.  It would not be quick or painless.

Joe Whitty