[comp.windows.x] Summary: warping cursor from text widget to text widget

crouch@axion.bt.co.uk (chris rouch) (05/25/90)

A couple of people asked me to let them know if I found out how to do this.

I asked:
>Is there any way of getting the cursor to warp from text widget to text
>widget without moving the mouse? Alternatively is there any way for
>input text to be directed to a different text widget to the one the
>cursor is over. I'm trying to create a form, and rather than have to
>keep moving the mouse between each text entry I would like to be able to
>use a tab (for example) to move around. 

I received solutions to both of these. To move the cursor the fucntion
needed is  XWarpPointer(). I was advised that some people consider this
anti-social, so I decided to adopt the second approach. 

The best reference for this is in the source for the text widget, in
particular TextPop.c, which handles the implementation of the search and
replace popup. What I needed to do was set up translations for each text
widget so that <tab> would call a function to set focus to the next
widget, and <Btn1Down> would call a function to set focus to the current
widget. This fuction uses XtSetKeyboardFocus to point the input at the
appropriate widget, and provides some kind of visual feedback (the text
widget popup changes the border, I opted for inverting the foreground
and background.


Thanks to everybody who replied.

Chris
-----------------------------------------------------------------------------
Chris Rouch                                             crouch@axion.bt.co.uk
RT3141, BTRL, Martlesham Heath, Ipswich, England.              +44 473 646093

Pick a card. Any card. WRONG.