Click or drag to resize

DataColumn.EnableCellDraw Method

X#
Enable the painting of individual cells by registering a cell-painting method.

Namespace:  VO
Assembly:  VOGUIClasses (in VOGUIClasses.dll) Version: 2.21
Syntax
 VIRTUAL METHOD EnableCellDraw(
	symMethodName
) AS USUAL CLIPPER
Request Example View Source

Parameters

symMethodName (Optional)
Type: Usual
The symbolic name of the method that will be used to paint the cells in this column.

Return Value

Type: Usual
Remarks
Enables the cells in this column to be painted according to a method supplied by the developer. The method provided will be called whenever the cell is about to be painted. The cell's usual value is passed to the method, and can be used to determine what text color and background brush should be used in painting, by assigning new values to DataColumn:CellTextColor and DataColumn:CellBackground, respectively.
Examples
The following example shows how DataColumn:EnableCellDraw may be used to highlight past due accounts in the data browser:
X#
 1CLASS ColorColumn INHERIT DataColumn
 2PROTECT oValidTextColor    AS Color
 3PROTECT oValidBackground    AS Brush
 4PROTECT oInvalidTextColor    AS Color
 5PROTECT oInvalidBackground AS Brush
 6METHOD Init( oFieldSpec ) CLASS ColorColumn
 7SUPER:Init( oFieldSpec )
 8oValidTextColor := Color{ COLORWHITE }
 9oValidBackground := Brush{ Color{ COLORBLUE } }
10oInvalidTextColor := Color{ COLORYELLOW }
11oInvalidBackground := Brush{ Color{ COLORRED } }
12RETURN SELF
13METHOD Init( oWindow, iCtlID, oServer ) CLASS ColorSubForm
14// some initialization code
15SELF:Browser := ColorSubForm_Browser{ SELF }
16oDBDUE_DATE := ColorColumn{ ACCOUNTS_DUE_DATE{} }
17oDBDUE_DATE:Width := 12
18oDBDUE_DATE:HyperLabel := oDCDUE_DATE:HyperLabel
19oDBDUE_DATE:Caption := "DueDate"
20SELF:Browser:AddColumn( oDBDUE_DATE )
21oDBDUE_DATE:EnableCellDraw( #ValidDateDraw )
22// more initialization code
23RETURN SELF
24METHOD ValidDateDraw( uValue ) CLASS ColorColumn
25IF uValue < GetPastDueDate()
26SELF:CellTextColor := oValidTextColor
27SELF:CellBackground := oValidBackground
28ELSE
29SELF:CellTextColor := oInvalidTextColor
30SELF:CellBackground := oInvalidBackground
31ENDIF
32RETURN NIL
See Also