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 String255 Caption format description
error Longint Error result

Sets up a caption object for area cells. Any previously defined caption object is deleted.

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_InvalidRectErr is returned.

String parameter displayFormat specifies a 4D Alpha Field Format string for formatting the caption text.

Notes

Example

`---------------------------------------------------------------------
` (1) set-up a caption object displaying the cell index
 
C_LONGINT($err;$left;$top;$right;$bottom;$format)
C_TEXT($xpression;$format)
 
$xpression:="String(gQGCurrentCell)"
 
$left:=4
$top:=102
$right:=106
$bottom:=114
 
$format:=""
 
$err:=QG_SetCellCaption (xGrid;$xpression;$left;$top;$right;$bottom;$format)
If ($err # qg_noErr)
  ` Handle the error
End if
 
 
`---------------------------------------------------------------------
` (2) set-up a caption object for area xGrid
 
C_LONGINT($err;$left;$top;$right;$bottom;$format)
C_TEXT($xpression;$format)
 
$xpression:="P_GetCaption(gQGCurrentCell)"
 
$left:=4
$top:=102
$right:=106
$bottom:=114
 
$format:=""
 
$err:=QG_SetCellCaption (xGrid;$xpression;$left;$top;$right;$bottom;$format)
If ($err # qg_noErr)
  ` Handle the error
End if
 
 
`-----------------------------------
` P_GetCaption (cell index) : caption text
` Simple routine used in the caption expression
 
C_LONGINT($1) ` grid cell index
C_TEXT($0) ` text result
 
GOTO SELECTED RECORD([Photos];$1)
 
$0:=[Photos]Comments

Related commands

QG_GetCellCaption Return the current caption object
QG_SetCaptionStyle Sets the caption text appearance
QG_SetCellPicture Setup a picture object for the area cells

QGrid © Escape
Generated by QDoc 2.8 on Thu, Oct 8, 2009 17:35:55