brian@is.UUCP (Brian Zimbelman) (06/12/91)
I am using X11R3 with Motif 1.0.3 ( 1.0 I'm sure of .3 I think ). I am having a few problems with the Motif Text widget. First of all I cannot programatically locate the cursor, and tell the widget to place that section of the text on the screen. I have a large multi-line text widget, which is modifiable. The user has selected (in another window) to look at all of the occurances of something, and I would like to display them to the user as selected strings one at a time. The user will either do something with them, or select next on the other window. The code I am using to update the current location of the text cursor is below: -------------------------- code section starts ------------------------- /* Get the buffers contents and current location */ buffer_str = (unsigned char *)XmTextGetString(text); /* Get string to search for */ srchfor = (unsigned char *)XmTextGetString(search_text); /* find location of string in buffer contents */ location = ISSearchString ( buffer_str, srchfor ); newpos = location - buffer_str; /* set current position to that location in buffer */ XmTextClearSelection ( text, cb->event->xbutton.time ); XmTextSetSelection ( text, newpos, newpos+strlen(srchfor), cb->event->xbutton.time ); -------------------------- code section ends --------------------------- As a side note, is there a way to find out where the cursor is currently located. Thank you for your help in advance. Brian Zimbelman ------------------------------------------------------------------------- Innovative Solutions bbx.basis.com!is!brian 3547 Colorado NE is!brian@bbx.basis.com Albuquerque NM 87110 (505) 883-4252