BBjStandardGrid::setCellImage

Description

In BBj 5.00 and higher, this method sets the image displayed in a BBjStandardGrid cell.

Syntax

Return Value Method
void setCellImage(int row, int column, BBjImage image!)
void setCellImage(BBjVector cells, BBjImage image!)
void setCellImage(BBjVector cells, BBjVector images!)

Parameters

Parameter Description
row Row of cell for which image is set.
column Column of cell for which image is set.
image! BBjImage to display in the cell(s).
cells BBjVector of BBjGridCells.
images! BBjVector of BBjImages.

Return Value

None.

Remarks

This method does not affect cells of type GRID_CELL_TEXT. To add an image to a cell of type GRID_CELL_TEXT, pass an HTML string to setCellText().

Note:

To use a BBjVector of BBjImages, each BBjGridCell needs an image location set with BBjGridCell::setImageLocation. Multiple grid cells can have the same image location.

Example

The first row sets a single image to a single cell, the second row sets a single image to a BBjVector of cells, and the third row sets a BBjVector of BBjImages to a BBjVector of BBjGridCells.

rem 'Set cell image in a BBjStandardGrid object

rem 'Obtain the instance of the BBjAPI object
let myAPI!=BBjAPI()

rem 'Open the SysGui device
SYSGUI=UNT
OPEN (SYSGUI) "X0"

rem 'Obtain the instance of the BBjSysGui object
let mySysGui!=myAPI!.getSysGui()

rem 'Set addWindow param values
X=10
Y=10
WIDTH=400
HEIGHT=500
TITLE$="BBjStandardGrid"

rem 'Set the current context
mySysGui!.setContext(0)

rem 'Create a window
myWindow! = mySysGui!.addWindow(X,Y,WIDTH,HEIGHT,TITLE$)
rem 'Add a grid on the window
myGrid! = myWindow!.addGrid(101, 10, 10, 300, 400, $8060$, 4, 2)

rem 'Set the grid properties
myGrid!.setDefaultColumnWidth(150)
myGrid!.setRowHeight(90)

rem 'Create Images using BBjImage Manager
Pro5url$ = "https://basis.cloud/wp-content/uploads/2023/10/vpro5logo-1.jpg"
BBjurl$ = "https://basis.cloud/wp-content/uploads/2023/10/BBjlogo.jpg"
myImageManager! = mySysGui!.getImageManager()
myPro5Image! = myImageManager!.loadImageFromURL(Pro5url$)
myBBjImage! = myImageManager!.loadImageFromURL(BBjurl$)

rem 'Set the image of a single cell
myGrid!.setCellImage(0,0,myPro5Image!)

rem 'Set the image of multiple cells
cellsA! = mySysGui!.makeVector()
cellsA!.addItem(myGrid!.getCell(1, 0))
cellsA!.addItem(myGrid!.getCell(1, 1))
myGrid!.setCellImage(cellsA!, myBBjImage!)

rem 'Set the images of mutiple cells
Images! = mySysGui!.makeVector()
Images!.addItem(myPro5Image!)
Images!.addItem(myBBjImage!)
cellsB! = mySysGui!.makeVector()
cellsB!.addItem(myGrid!.getCell(2, 0))
cellsB!.getItem(0).setImageLocation(0)
cellsB!.addItem(myGrid!.getCell(2, 1))
cellsB!.getItem(1).setImageLocation(1)
myGrid!.setCellImage(cellsB!, Images!)

rem 'Register the CALLBACK routines
CALLBACK(ON_CLOSE,APP_CLOSE, mySysGui!.getContext())

rem 'Process Events
process_events

rem 'Callback routine called when the user closes the application window
APP_CLOSE:
release

ClosedVersion History

  • BBj 19.00: Added an optional set of arguments using cells and images!.
  • BBj 5.00: BBjStandardGrid::setCellImage added.

See Also

BBjAPI

BBjGridCell::getImageLocation

BBjGridCell::setImageLocation

See the BBj Object Diagram for an illustration of the relationship between BBj Objects.