TE Edit Control Java / HTML-JavaScript Help
Product page

TerTextPosToPix

Retrieve the pixel position of the text.

boolean TerTextPosToPix( RelativeTo, line, col, out x, out y)
int RelativeTo;This parameter should be set to one of the following constants:

REL_SCREEN: To return the x/y values relative to the top of the screen.

REL_WINDOW: To return the x/y values relative to the client area of the edit control.

REL_TEXT_BOX: To return the x/y values relative to the top of the text box.

int line;The line number of the text to find position. Set this parameter to -1 to retrieve the pixel position of the text at the current caret location.
int col;The column number of the text to find position. To specify an absolute location, set the col to -1, and specify the absolute position in the 'line' argument.

Upon a successful return from this method, the following information can be retrieved by using TerGetOutInt method:

int x;

The parameter to receive the x pixel position.

Upon a successful return from this method, the MagX value can be retrieve as following:

x=tej.TerGetOutInt("X")
int y;

The parameter to receive the y pixel position.

Upon a successful return from this method, the MagX value can be retrieve as following:

y=tej.TerGetOutInt("Y")

Return Value: This function returns true when successful.

Example: The example below retrieves the pixel position at the current cursor location relative to the top of the text box.

 int x,y,
 if (tej.TerTextPosToPix( tej.REL_TEXT_BOX, -1, -1)) {
    x=tej.TerGetOutInt("X")
    y=tej.TerGetOutInt("Y")
 }