Article # 42, added by Geoworks, historical record
| first |
previous |
index |
next |
last |
Line number of cursor in text object.
Question: How do I get the line number that a cursor is on in a text object? Answer: Use this code snippet, substituting "MyText" for the optr to the text object you are interested in: dword lineNum, position; VisTextRange range; /* Get the current cursor position. */ @call MyText::MSG_VIS_TEXT_GET_SELECTION_RANGE( &range ); /* If no selection, then this is the cursor position. */ position = range.VTR_start; /* I found this message in vtextc.goh */ * Add the 1 to get first line to be number one * instead of zero. */ lineNum = 1 + ( @call MyText:: MSG_VIS_TEXT_GET_LINE_FROM_OFFSET( position ) ); Thanks to John F. Howard, a GeoRep and ISV, for this answer.