QGrid
![]() |
![]() ![]() |
QG_SetCellPicture(areaRef; pictExpression; rectLeft; rectTop; rectRight; rectBottom; displayFormat):errorCode | |||
![]() |
areaRef | Longint | QGrid area reference |
![]() |
pictExpression | Text | Expression returning picture |
![]() |
rectLeft | Longint | Left coordinate |
![]() |
rectTop | Longint | Top coordinate |
![]() |
rectRight | Longint | Right coordinate |
![]() |
rectBottom | Longint | Bottom coordinate |
![]() |
displayFormat | Longint | Picture format number |
![]() |
error | Longint | Error result |
Sets up a picture object for area cells. Any previously defined picture 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 pictExpression specifies a 4D picture expression to be used for drawing each cell's picture. QGrid calls this expression every time it needs to draw a cell's picture. 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 picture box coordinates in the cell's coordinate system. Picture box coordinates can fall outside the cell bounds and even have negative values. In these cases only the visible part of the picture object's box is drawn on the cell. In case the values given do not specify a rectangle, error qg_InvalidRectErr is returned.
Long parameter displayFormat specifies the picture display format. QGrid defines the following constants for picture display formats:
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 |
Notes
Example
` Set-up a picture object for area xGrid C_LONGINT($err;$left;$top;$right;$bottom;$format) C_TEXT($xpression) $xpression:="P_GetPicture(gQGCurrentCell)" $left:=2 $top:=2 $right:=98 $bottom:=108 $format:=qg_PictXScaledToFitPropCenter $err:=QG_SetCellPicture (xGrid;$xpression;$left;$top;$right;$bottom;$format) If ($err # qg_noErr) ` Handle the error End if `----------------------------------- ` P_GetPicture (cell index) : cell picture ` Simple routine used in the picture expression C_LONGINT($1) ` grid cell index C_PICTURE($0) ` result GOTO SELECTED RECORD([Photos];$1) $0:=[Photos]Image |
Related commands
QG_GetCellPicture | Return the current picture object |
QG_SetCellCaption | Setup a caption object for the area cells |