TSay

Fonte: source/classes/say.prg

Inherits from: TControl

TSay renders static text within a window or dialog. It is the standard control for labels, prompts, and read-only text display. TSay supports data binding via bSetGet, automatic refresh when the bound variable changes, picture clauses for formatted output, 3D effects (raised or sunk), transparent backgrounds, border styles, and tooltip text. It is one of the most frequently used controls in FiveWin applications.

Key DATA Members

DATATypeDescription
bSetGetBlockData-binding code block. When the say is refreshed, the block is evaluated and the result becomes the displayed text.
cPictureCharacterPicture clause for formatted output (e.g. "999,999.99", "@!" for uppercase).
nClrBorderNumericBorder color when lBorder is .T. (RGB value).
bClrTextBlockCode block that returns a color value. Evaluated at paint time to support dynamic text colors.
l3DLogicalIf .T., the text is rendered with a 3D effect (raised or etched).
lAdjustLogicalIf .T., the control size adjusts automatically to fit the text content.
lBorderLogicalIf .T., a border is drawn around the say control.
nClrTextNumericText foreground color (RGB value).
nClrPaneNumericBackground fill color (RGB value).
cCaptionCharacterCurrent displayed text.

Methods

MethodDescription
New( nRow, nCol, bText, oWnd, nClrT, nClrP, oFont, lPixel, lDesign, lTransparent, cMsg, lUpdate, cPict, lBorder, lAdjust, oToolTip, nClrBorder )Create a new say control. bText is a fixed string or code block that returns the text. The say is immediately created as a child of oWnd.
ReDefine( nId, bText, oWnd )Redefine a say from a dialog resource. Links to an existing Win32 static control by its control ID.
SetText( cText )Change the displayed text directly (overrides bSetGet).
Refresh()Re-evaluate the data-bound text and repaint the control. If bSetGet is set, the block is re-evaluated.
SetColor( nClrText, nClrPane )Change the text and background colors dynamically.
SetFont( oFont )Assign a new font to the say control.
End()Destroy the control and remove it from the parent's aControls.

Commands: @ ... SAY

@ nRow, nCol SAY oSay ;
   PROMPT cText | VAR cVar ;
   SIZE nW, nH ;
   [ OF oDlg ] ;
   [ COLOR nClrText, nClrPane ] ;
   [ FONT oFont ] ;
   [ PICTURE cPict ] ;
   [ TRANSPARENT ] ;
   [ 3D ] [ NO3D ] ;
   [ BORDER ] ;
   [ ADJUST ] ;
   [ UPDATE ] ;
   [ TOOLTIP cTip ]

Example: Auto-Refresh Say from Variable

#include "FiveWin.ch"

function Main()

   local oWnd, oSay, nCounter := 0

   DEFINE WINDOW oWnd TITLE "TSay Demo" SIZE 400, 200

   // Static prompt
   @ 30, 20 SAY "Counter:" OF oWnd SIZE 60, 12

   // Data-bound say that auto-updates
   @ 30, 90 SAY oSay VAR nCounter OF oWnd ;
      SIZE 100, 20 UPDATE PICTURE "999,999"

   @ 100, 20 BUTTON "Increment" OF oWnd SIZE 100, 30 ;
      ACTION ( nCounter++, oSay:Refresh() )

   ACTIVATE WINDOW oWnd CENTERED

return nil

Notes

Veja Também