QG_SetCellOptions

QG_SetCellOptions(areaRef; cellWidth; cellHeight; bkgPict; bkgPictFormat):errorCode
areaRef Longint QGrid area reference
cellWidth Longint Cell width
cellHeight Longint Cell height
bkgPict Picture Background picture
bkgPictFormat Longint Background picture format
error Longint Error result

Sets the properties of the grid cells. Use this command to specify cell width, height and background picture.

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 and its display format. If both parameters are omitted, no background is drawn.

If you have set a background picture, 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

 

Calling QG_SetCellOptions for a QGrid area a second time omitting parameters bkgPict and bkgPictFormat will clear any previous cell background picture.

If you don't call this command for a QGrid area, the plug-in will default to the following values:

Cell width:160 pixels
Cell height:160 pixels
Background picture:none
Background picture format:not applicable (0)

Example

`---------------------------------------------------------------------
` (1) Use a picture from 4D's Picture Library as the cell background
 
C_LONGINT($err;$w;$h;$format)
C_PICTURE($pict)
 
GET PICTURE FROM LIBRARY(1001;$pict)
 
$w:=-1 `cell width equals bkg pict width
$h:=-1 `cell height equals bkg pict height
$format:=qg_PictScaledToFit
 
$err:=QG_SetCellOptions (xGrid;$w;$h;$pict;$format)
If ($err # qg_noErr)
  ` Handle the error
End if
 
 
`---------------------------------------------------------------------
` (2) Set the cell dimensions to 100 x 100 pixels and clear the background picture
 
C_LONGINT($err;$w;$h)
 
$w:=100
$h:=100
 
$err:=QG_SetCellOptions (xGrid;$w;$h)
If ($err # qg_noErr)
  ` Handle the error
End if
 
 
 

Related commands

QG_GetCellOptions Returns the current grid cell properties

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