System Functions
TXW( ) Text Width
   
Format TXW(string$[,chan][,ctrlopt])

Where:

chan Channel or logical file number of the device.
ctrlopt Control options. Supported options for TXW( ) include:
ERR=stmtref Error transfer
FNT="font",size[,attr]" Font name, size, properties
string$ String expression.
   
Returns Text width in graphical units (i.e., @X(col) and @Y(line) values).


*Note* For use in graphics mode along with TXH( ) Text Height.


   
Description The TXW( ) function returns text width in graphical units for the given string$. If chan is omitted, ProvideX assumes it is dealing with the main window. If the font selected indicates that the ampersand character is used to denote underscored characters, TXW( ) does not include the '&' character during its calculations.
   
Example If you want to create a window based on the length of a message, use TXW( ) to determine the size of the window/dialogue to create; e.g.,

0055 LET LINE1$="Line 1."
0056 LET LINE2$="Line 2.."
0057 LET LINE3$="This is Line 3..."
0100 LET W1=TXW(LINE1$,FNT="MS Sans Serif")
0110 LET W2=TXW(LINE2$,FNT="MS Sans Serif")
0120 LET W3=TXW(LINE3$,FNT="MS Sans Serif")
0130 LET W=MAX(W1,W2,W3)
0140 LET W=INT(W/16)+4 ! Allow for up to 4 extra white spaces
0150 PRINT 'DIALOGUE'(C,L,W,5,TITLE$),'SR','CS',
0160 PRINT 'FONT'("MS Sans Serif"),
0170 PRINT 'TEXT'(@X(2),@Y(1),LINE1$),
0180 PRINT 'TEXT'(@X(2),@Y(2),LINE2$),
0190 PRINT 'TEXT'(@X(2),@Y(3),LINE3$),
0200 MSGBOX "Press OK to continue."



*Note* The logical width is based on logical pixel 1/16ths the size of a single column width