rem 'Get the text of a cell in a BBjGrid 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 'Create the main window and control objects
GOSUB CreateGrid
rem 'Display the main window
MainWindow!.setVisible(mySysGui!.TRUE)
rem 'Register the CALLBACK routines
CALLBACK(ON_CLOSE,DoAppClose,GridContext)
CALLBACK(ON_GRID_CELL_MODIFY,DoEditCell,GridContext,Grid!.getID())
rem 'Process Events
process_events
rem 'Callback routine called when the user closes the application window
DoAppClose:
release
rem 'Callback routine called when the user edits a grid cell
DoEditCell:
print "Edit text is: ",Grid!.getEditText()
return
rem 'Subroutine called to create the grid
CreateGrid:
let TITLE$="BBjGrid"
let DayMask$="##B"
let CurrentJul=0,CalX=400,CalY=400
rem 'Get the next available context
let GridContext=mySysGui!.getAvailableContext()
mySysGui!.setContext(GridContext)
rem 'Create the main window
let MainWindow! = mySysGui!.addWindow(100,100,186,160,TITLE$,$00010013$)
rem 'Add the calendar (grid) to the main window
let Grid! = MainWindow!.addGrid(100,3,26,178,121)
rem 'Set the attributes of the grid
Grid!.setGridEditable(1)
blueColor! = mySysGui!.makeColor(mySysGui!.BLUE)
Grid!.setColumnHeaderForeColor(blueColor!)
Grid!.setNumRows(6)
Grid!.setRowHeight(20)
Grid!.setNumColumns(3)
Grid!.setMaxColumns(255)
Grid!.setHasColumnHeader(mySysGui!.TRUE)
Grid!.setVerticalLinesVisible(mySysGui!.TRUE)
Grid!.setHorizontalLinesVisible(mySysGui!.TRUE)
Grid!.setClientEdge(mySysGui!.TRUE)
Grid!.setSelectionMode(Grid!.GRID_SELECT_CELL)
Grid!.setGridEditable(mySysGui!.TRUE)
rem 'Set the attributes for the grid's columns
FOR COL = 0 TO 2
Grid!.setColumnWidth(COL, 50)
Grid!.setColumnAlignment(Col,Grid!.GRID_ALIGN_RIGHT)
Grid!.setColumnForeColor(COL, blueColor!)
NEXT COL
Grid!.setColumnHeaderForeColor(blueColor!)
rem 'Set the attributes for the current date (static text control)
let CurrDate! = MainWindow!.addStaticText(101,45,3,90,20,"")
CurrDate!.setClientEdge(mySysGui!.TRUE)
CurrDate!.setForeColor(blueColor!)
return
|