[futurebasic] re: Number of lines in BOX?

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : December 1998 : Group Archive : Group : All Groups

From: Bowerbird@...
Date: Wed, 30 Dec 1998 15:24:18 EST
hans said:
>   I have to know how many lines my string took in the first CBOX.

put the text into an edit field of the right width,
an edit field that is located outside the window.

then test for the height of the edit field
to calculate the number of lines it contains.

CLEAR LOCAL FN getFieldHt(theFld)
  '---------------------------------------
  ' Calculate the height of a styled
  ' text edit field. NOTE: You cannot
  ' make this calculation in an open
  ' printer port.
  '---------------------------------------
  DIM TEHndl&,chrCount
  DIM thePoint&;0,pointY,pointX
  DIM fldTop,fldHeight
  TEHndl&=TEHANDLE(theFld)
  LONG IF TEHndl&
    chrCount= {[TEHndl&] + _TELength}
    thePoint&=FN TEGETPOINT(chrCount,TEHndl&)
    fldTop= {[TEHndl&]}
    fldHeight=pointY - fldTop
  XELSE
    fldHeight=0
  END IF
END FN=fldHeight : REM getfieldht