Hi,
While LSET and RSET are often used to store data in a file on disk,
they are not appropriate for the display on screen.
Here are possible entries for graphical LSET and RSET functions:
'~LSET/RSET
LOCAL MODE
LOCAL FN LSET$( srcStr AS STR255, dstStr AS STR255 )
LONG IF dstStr[0]
LONG IF FN TruncString(FN StringWidth(dstStr),srcStr,_smTruncEnd)
END IF
XELSE
srcStr[0] = 0
END IF
END FN = srcStr
LOCAL MODE
LOCAL FN RSET$( srcStr AS STR255, dstStr AS STR255 )
DIM w AS INTEGER
LONG IF dstStr[0]
w = FN StringWidth( dstStr )
LONG IF FN TruncString(w,srcStr,_smTruncMiddle) <= 0
WHILE _true
LONG IF FN StringWidth(srcStr + " ") <= w
srcStr = " " + srcStr
XELSE
EXIT WHILE
END IF
WEND
END IF
XELSE
srcStr[0] = 0
END IF
END FN = srcStr
WINDOW 1
TEXT _times,18
DIM myStr AS STR255
DIM fitStr AS STR255
myStr = "Hello World"
fitStr = "FN RSET$ calibrates this string:"
PRINT:PRINT "FN LSET$ calibrates this string:"
PRINT FN LSET$( myStr, fitStr )
PRINT:PRINT "FN RSET$ calibrates this string:"
PRINT FN RSET$( myStr, fitStr )
myStr = "L'Etat n'a pas besoin des savants"
PRINT:PRINT "FN LSET$ calibrates this string:"
PRINT FN LSET$( myStr, fitStr )
PRINT:PRINT "FN RSET$ calibrates this string:"
PRINT FN RSET$( myStr, fitStr )
DO
HANDLEEVENTS
UNTIL FN Button
--
Cheers
Alain
-----------------------------------------------------
FB^3 in Europe: http://euro.futurebasic.com/
FB II Pouch: http://www.pixmix.com/FB/outils.html
-----------------------------------------------------