I have bee using this just fine:
Untill I was sent a TAB delimited file. I display the first 8 lines of the file in a window. The window is sized using:
LINE INPUT #425, InputStr
GETTEXTEXTENTPOINT32 hDc, BYVAL STRPTR(InputStr), LEN(InputStr), lpSize ' Max width of first line
WdPix = lpSize.cx
DisplayStr = ""
FOR i = 1 TO 8
LINE INPUT #425, InputStr
GETTEXTEXTENTPOINT32 hDc, BYVAL STRPTR(InputStr), LEN(InputStr), lpSize ' does not work for Tabs
IF lpSize.cx > WdPix THEN WdPix = lpSize.cx
DisplayStr = DisplayStr+InputStr+$CRLF
NEXT
CLOSE #425 ' Close Input file
WdPix = WdPix + 18 ' to take account for LH margin in this Window type
HtPix = lpSize.cy ' the Height of any line
DIALOG PIXELS CBHNDL, WdPix, HtPix TO UNITS Wd, Ht ' Convert to Dialog units
Ht = (TALLY(DisplayStr, $CRLF)+2)*Ht ' Multiply by the number of lines
DIALOG SET SIZE CBHNDL, Wd, Ht ' Set the Window Size
What do I need to include to adjust for the width of a TAB?
------------------
Kind Regards
Mike
Untill I was sent a TAB delimited file. I display the first 8 lines of the file in a window. The window is sized using:
LINE INPUT #425, InputStr
GETTEXTEXTENTPOINT32 hDc, BYVAL STRPTR(InputStr), LEN(InputStr), lpSize ' Max width of first line
WdPix = lpSize.cx
DisplayStr = ""
FOR i = 1 TO 8
LINE INPUT #425, InputStr
GETTEXTEXTENTPOINT32 hDc, BYVAL STRPTR(InputStr), LEN(InputStr), lpSize ' does not work for Tabs
IF lpSize.cx > WdPix THEN WdPix = lpSize.cx
DisplayStr = DisplayStr+InputStr+$CRLF
NEXT
CLOSE #425 ' Close Input file
WdPix = WdPix + 18 ' to take account for LH margin in this Window type
HtPix = lpSize.cy ' the Height of any line
DIALOG PIXELS CBHNDL, WdPix, HtPix TO UNITS Wd, Ht ' Convert to Dialog units
Ht = (TALLY(DisplayStr, $CRLF)+2)*Ht ' Multiply by the number of lines
DIALOG SET SIZE CBHNDL, Wd, Ht ' Set the Window Size
What do I need to include to adjust for the width of a TAB?
------------------
Kind Regards
Mike
Comment