TFLine

Source: source/classes/fline.prg

Standalone class

TFLine (Formatted Line) is a utility class for composing a formatted line from multiple styled text fragments. Each fragment can have its own font, color, and alignment. TFLine is used in conjunction with TSay:oLine to render rich text labels and with TReport's formatted line output. The class maintains an array of text, font, and color triplets that are drawn as a single line with word wrap controlled by lCrLf.

Key DATA Members

DATATypeDescription
oUpObjectLinked upstream object (used in line chains)
oDownObjectLinked downstream object
nalignNumericLine alignment value (0 = default)
aTextArrayArray of text strings for each fragment
aFontsArrayArray of font objects or indexes for each fragment
aColorsArrayArray of color values for each fragment
lCrLfLogicalInsert carriage return/line feed after this line

Methods

MethodDescription
New( nalign, aText, aFonts, aColors, lCrLf )Create a formatted line with the given fragments. Defaults: {}, {}, {}, 0, .F.
End()Release linked objects (sets oUp and oDown to NIL)

Example: Styled Text Fragments

#include "FiveWin.ch"

function FormattedLabel()

   local oSay, oLine

   DEFINE FONT oFont1 NAME "Arial" SIZE 0, -24
   DEFINE FONT oFont2 NAME "Arial" SIZE 0, -18 BOLD

   oLine := TFLine():New( 0, ;
      { "Welcome ", "FiveWin ", "User" }, ;
      { oFont1, oFont2, oFont1 }, ;
      { CLR_BLUE, CLR_RED, CLR_BLACK } )

   // Use oLine with TSay for display
   @ 10, 10 SAY oSay PROMPT "" OF oWnd SIZE 300, 50
   oSay:oLine := oLine
   oSay:lTransparent := .T.

return nil

Notes

See Also