TerPixToTextPos
Retrieve the text position at a given pixel position.
boolean TerPixToTextPos( RelativeTo, x, y, pCol)
int RelativeTo; | This parameter should be set to one of the following constants: |
| REL_SCREEN: | When specifying the x/y values relative to the top of the screen. |
| REL_WINDOW: | When specifying the x/y values relative to the client area of the edit control. |
| REL_TEXT_BOX: | When specifying the x/y values relative to the top of the text box. |
int x; | The x position of the pixel. |
int y; | The y position of the pixel. |
// To retrieve the absolute text position in the pLine parameter, set the pCol parameter to null or set the column number to -1.
Upon a successful return from this method, the following information can be retrieved by using TerGetOutInt method:
int pLine; | Upon successful return from this method, the corresponding line number can be retrieved as following: line=tej.TerGetOutInt("Line"); |
int pCol; | Upon successful return from this method, the corresponding line number can be retrieved as following: col=tej.TerGetOutInt("Col"); |
Return Value: This function returns true when successful.
Example: The example below retrieves the text position at a pixel position x=100, y=100.
int line;
int col=0; // set to 0 to retrieve the position in
// line/column format.
if (TerPixToTextPos( tej.REL_TEXT_BOX, 100, 100, col)) {
line=tej.TerGetOutInt("Line");
col=tej.TerGetOutInt("Col");}