Specifications

Athena Widget Set libXaw 1.0.7
5.11.2.4. Finding aText Position GivenPixel Values
To find the text character position that will be rendered at a givenxlocation the Textwidget uses
the function FindPosition:
void FindPosition(w, fromPos, fromX, width, stopAtWordBreak, pos_return, width_return, height_return)
Widget w;
XawTextPosition fromPos;
int fromX, width;
Boolean stopAtWordBreak;
XawTextPosition *pos_return;
int *width_return, *height_return;
w Specifies the TextSink object.
fromPos Specifies a reference position, usually the first character in this line. This
character is always to the left of the desired character location.
fromX Specifies the distance that the left edge of fromPos is from the left edge of the
window. This is the reference x location for the reference position.
width Specifies the distance, in pixels, from the reference position to the desired
character position.
stopAtWordBreak Specifies whether or not the position that is returned should be forced to be
on a word boundary.
pos_return Returns the character position that corresponds to the location that has been
specified, or the work break immediately to the left of the position if stopAt-
WordBreak is True.
width_return Returns the actual distance between fromPos and pos_return.
height_return Returns the maximum height of the text between fromPos and pos_return.
This function need makenoattempt to deal with line feeds. The text widget will only call it one
line at a time.
Another means of finding a text position is provided by the Resolve function:
void Resolve(w, fromPos, fromX, width, pos_return)
Widget w;
XawTextPosition fromPos;
int fromX, width;
XawTextPosition *pos_return;
w Specifies the TextSink object.
fromPos Specifies a reference position, usually the first character in this line. This charac-
ter is always to the left of the desired character location.
fromX Specifies the distance that the left edge of fromPos is from the left edge of the
window. This is the reference x location for the reference position.
width Specifies the distance, in pixels, from the reference position to the desired charac-
ter position.
pos_return Returns the character position that corresponds to the location that has been spec-
ified, or the word break immediately to the left if stopAtWordBreak is True.
This function need makenoattempt to deal with line feeds. The text widget will only call it one
line at a time. This is a more convenient interface to the FindPosition function, and provides a
subset of its functionality.
105