QG_SetCellCaption
QG_SetCellCaption(areaRef; captionXpression; rectLeft; rectTop; rectRight; rectBottom; displayFormat):errorCode | |||
---|---|---|---|
![]() |
areaRef | Longint | QGrid area reference |
![]() |
captionXpression | Text | Expression returning text |
![]() |
rectLeft | Longint | Left coordinate |
![]() |
rectTop | Longint | Top coordinate |
![]() |
rectRight | Longint | Right coordinate |
![]() |
rectBottom | Longint | Bottom coordinate |
![]() |
displayFormat | Text | Caption format description |
![]() |
error | Longint | Error result |
Set the caption object for area cells
Parameter areaRef is the QGrid area reference. If areaRef is not a valid QGrid area reference, qg_paramErr error is returned.
Parameter captionXpression specifies a 4D text expression to be used for calculating each cells caption text. QGrid calls this expression every time it needs to draw a cell's caption. Before calling the expression it sets the global variable gQGCurrentCell to the cell index it needs to display. This variable can then be used inside the expression.
Parameters rectLeft, rectTop, rectRight and rectBottom specify the caption box coordinates in the cell's coordinate system. Caption box coordinates can fall outside the cell bounds and even have negative values. In these cases only the visible part of the caption object's box is drawn on the cell. In case the values given do not specify a rectangle, error qg_paramErr is returned.
String parameter displayFormat specifies a 4D Alpha Field Format string for formatting the caption text.
NOTE To delete a previously defined caption object, call QG_SetCellCaption with captionXpression set to empty text. The rest of the parameters are then ignored and can be omitted.
Examples
// Setup the cell caption to display the cell index. C_TEXT($expression) $expression:="gQGCurrentCell" C_LONGINT($err;$captLeft;$captTop;$captRight;$captBottom) $captLeft:=4 $captTop:=102 $captRight:=106 $captBottom:=114 C_TEXT($format) $captFormat:="###" $err:=QG_SetCellCaption (xGrid;$expression;$captLeft;$captTop;$captRight;$captBottom;$format) ASSERT($err=qg_noErr)
// Set-up the caption for plug-in area xGrid. C_TEXT($expression) $expression:="DB_GetGridCaption(gQGCurrentCell)" C_LONGINT($err;$captLeft;$captTop;$captRight;$captBottom) $captLeft:=4 $captTop:=102 $captRight:=106 $captBottom:=114 $err:=QG_SetCellCaption (xGrid;$expression;$captLeft;$captTop;$captRight;$captBottom;"") ASSERT($err=qg_noErr)
// Method DB_GetGridCaption(cell index): cell picture // Simple routine used in the caption expression . C_LONGINT($1)// Cell index C_TEXT($0)// Caption text GOTO SELECTED RECORD([Photos];$1) $0:=[Photos]Comments
Related commands
QG_GetCellCaption | Get the current caption object properties |
QG_SetCaptionFont | Set the caption font |
QG_SetCaptionColors | Set the caption colors |
QG_SetCaptionAlignment | Set the caption text alignment |
QG_SetCellPicture | Set the picture object of area cells |