Article # 69, added by Geoworks, historical record
| first | previous | index | next | last |

MSG_VIS_TEXT_GET_LINE_INFO




Here is an example of how MSG_VIS_TEXT_GET_LINE_INFO can be 
used. In this example, the routine takes the character 
position (which could have been gotten by 
MSG_VIS_TEXT_GET_SELECTION_PTR) and returns the number of 
characters on that line. 
 
word GetCharacterCountForThisLine(dword charPosition) 
{ 
  VisTextGetLineInfoReturnValues retValue; 
  VisTextGetLineInfoParameters  vtglip; 
  LineInfo lineInfo; 
 
 /* 
  * Convert the character position to the line number that 
  * the character is on. 
  */ 
 
  vtglip.VTGLIP_line = @call Text:: 
  MSG_VIS_TEXT_GET_LINE_FROM_OFFSET(charPosition); 
 
 /* 
  * Set up the pointer to the buffer that VIS_TEXT_GET_LINE_INFO
  * will fill in.  In this case, we just want to basic line info.
  * If you want more FieldInfo structures, make sure to provide
  * a larger structure. 
  */ 
 
  vtgip.VTGLIP_buffer = &lineInfo; 
  vtgip.VTGLIP_bsize = sizeof(LineInfo); 
 
 /* 
  * Get the line information 
  */ 
 
  @call Text::MSG_VIS_TEXT_GET_LINE_INFO(&retValue, 
&vtglip); 
 
 /* 
  * Return the number of characters on the selected line. 
  * However, only return a word size because we'll never 
  * run on a device whose screen can allow more than 32,000 
  * characters on a single line. 
  */ 
 
  return (lineInfo.LI_count.WAAH_low); 
}