QG_SetCellOptions(areaRef; cellWidth; cellHeight; bkgPict; bkgPictFormat; xCornerRadius; yCornerRadius):errorCode
areaRef Longint QGrid area reference
cellWidth Longint Cell width
cellHeight Longint Cell height
bkgPict Picture Background picture
bkgPictFormat Longint Background picture format
xCornerRadius Longint Cell corner radius on the X axis
yCornerRadius Longint Cell corner radius on the Y axis
error Longint Error result

Set the properties of the grid cells

Parameter areaRef is the QGrid area reference. If areaRef is not a valid QGrid area reference, qg_paramErr error is returned.

Parameters cellWidth and cellHeight define the cell dimensions in pixels.

Parameters bkgPict and bkgPictFormat define a picture as the cell's background image and display format. If both parameters are omitted, no background is drawn.

If a background picture has been set, setting both cellWidth and cellHeight to -1 will result in the cell being equal in size to the background picture. In this case bkgPictFormat is ignored and can be omitted.

QGrid defines the following constants for the picture format:

qg_PictTruncCentered 1 Same as 4D's Truncated Centered (default)
qg_PictScaledToFit 2 Same as 4D's Scaled To Fit
qg_PictTruncNonCenter 4 Same as 4D's Truncated non Centered
qg_PictScaledToFitProp 5 Same as 4D's Scaled to fit proportional
qg_PictScaledToFitPropCenter 6 Same as 4D's Scaled to fit prop centered
qg_PictXScaledToFitProp 8 Same as 4D's Scaled to fit proportional, but scales up as well
qg_PictXScaledToFitPropCenter 9 Same as 4D's Scaled to fit prop centered, but scales up as well

TIP To clear an existing background, call QG_SetCellOptions omitting parameters bkgPict and bkgPictFormat.

Parameters xCornerRadius and yCornerRadius are optional. When used and greater than zero, they specify the cell's corner roundness by setting the radii across the X and Y axes respectively. The value of xCornerRadius must be less than or equal to half the cell's width. Respectively, yCornerRadius must be less than or equal to half the cell's height.

NOTE If this command is not called, the default values are used: width=160, height=160, no background picture, no rounded corners.


   // Use an image from the resources folder as the cell backgound.
   // Set the cell to display rounded corners with 6 pixels radius.

$cellImagePath:=Get 4D folder(Current resources folder)+"Cells"+Folder separator+"Cell.png"
ASSERT(Test path name($cellImagePath)=Is a document)

READ PICTURE FILE($cellImagePath;$cellPict)


$width:=-1// Cell width equals to the background picture width.
$height:=-1// Cell height equals to the background picture height.


$err:=QG_SetCellOptions (xGrid;$width;$height;$cellPict;qg_PictScaledToFit;6;6)
   // Set the cell dimensions to 320 x 240 pixels and clear the background picture




$err:=QG_SetCellOptions (xGrid;$width;$height)

Related commands

QG_GetCellOptions Get the current grid cell properties