rem 'BBjGridCell::setImageLocation and BBjGridCell::getImageLocation example
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$)
images! = mySysGui!.makeVector()
images!.addItem(myBBjImage!)
images!.addItem(myPro5Image!)
rem 'Set images of multiple cells
cells! = mySysGui!.makeVector()
cells!.addItem(myGrid!.getCell(1, 0))
cells!.getItem(0).setImageLocation(0)
cells!.addItem(myGrid!.getCell(1, 1))
cells!.getItem(1).setImageLocation(1)
cells!.addItem(myGrid!.getCell(3, 0))
cells!.getItem(2).setImageLocation(1)
myGrid!.setCellImage(cells!, images!)
rem 'Collect info on a cell in the cells! vector
CELL_INDEX = 2
CellInfo! = cells!.getItem(CELL_INDEX)
print "The cell in row",CellInfo!.getRow()+1,", column",CellInfo!.getColumn()+1," is using image",CellInfo!.getImageLocation()
print images!.getItem(CellInfo!.getImageLocation())
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
|