TSay
Fuente: 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
| DATA | Type | Description |
|---|---|---|
bSetGet | Block | Data-binding code block. When the say is refreshed, the block is evaluated and the result becomes the displayed text. |
cPicture | Character | Picture clause for formatted output (e.g. "999,999.99", "@!" for uppercase). |
nClrBorder | Numeric | Border color when lBorder is .T. (RGB value). |
bClrText | Block | Code block that returns a color value. Evaluated at paint time to support dynamic text colors. |
l3D | Logical | If .T., the text is rendered with a 3D effect (raised or etched). |
lAdjust | Logical | If .T., the control size adjusts automatically to fit the text content. |
lBorder | Logical | If .T., a border is drawn around the say control. |
nClrText | Numeric | Text foreground color (RGB value). |
nClrPane | Numeric | Background fill color (RGB value). |
cCaption | Character | Current displayed text. |
Methods
| Method | Description |
|---|---|
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
- TSay inherits from TControl, which inherits from TWindow. All standard control methods are available.
- Use the
UPDATEclause (or setlUpdate := .T.) to make the say automatically refresh whenoWnd:Update()is called, which is useful for database field displays that should update when the record pointer moves. - The
VARclause (as opposed toPROMPT) creates abSetGetcode block bound to a Harbour variable. The say displays the current value of the variable. - The
PICTUREclause applies formatting to the displayed value, following Harbour's picture function syntax (e.g."999,999.99"for numeric formatting,"@!"for uppercase). - Set
TRANSPARENTwhen the say is placed over a gradient or bitmap background. Without it, the say draws an opaque background that may obscure the parent's background. - The 3D effect draws the text with a shadow offset by one pixel, creating a raised or etched appearance. Use
NO3Dfor flat text.