BBjWindow::addGrid

Description

Creates a grid control in the BBjWindow.

Syntax

Return Value Method
BBjStandardGrid addGrid()
BBjStandardGrid addGrid(int ID)
BBjStandardGrid addGrid(int ID, int rowHeaderID, int columnHeaderID, number x, number y, number w, number h)
BBjStandardGrid addGrid(int ID, int rowHeaderID, int columnHeaderID, number x, number y, number w, number h, string flags)
BBjStandardGrid addGrid(int ID, int rowHeaderID, int columnHeaderID, number x, number y, number w, number h, string flags, int rows, int columns)
BBjStandardGrid addGrid(int ID, number x, number y, number w, number h)
BBjStandardGrid addGrid(int ID, number x, number y, number w, number h, string flags)
BBjStandardGrid addGrid(int ID, number x, number y, number w, number h, string flags, int rows, int columns)
BBjStandardGrid addGrid(int ID, string flags)
BBjStandardGrid addGrid(int ID, string flags, int rows, int columns)
BBjStandardGrid addGrid(string flags)
BBjStandardGrid addGrid(string flags, int rows, int columns)

Parameters

Variable Description
ID A positive integer that will be used to identify the grid. This number must be unique among the controls in the current window.
RowHeaderID A positive integer that will be used to identify the rowHeader of the grid. This number must be unique among the controls in the current window.
ColumnHeaderID A positive integer that will be used to identify the columnHeader of the grid. This number must be unique among the controls in the current window.
x Horizontal position of the upper-left corner of the grid in currently-scaled CONTROL units, relative to the inside of the window containing it.
y Vertical position of the upper-left corner of the grid in currently-scaled CONTROL units, relative to the inside of the window containing it.
width Width of the control in current units.
height Height of the control in current units.
flags May be empty or a two-byte binary string composed of any hexadecimal addition of the following values:
FlagsDescription
$0001$ Sets the grid control to be initially disabled.
$0002$ Creates a managed grid control as a column heading.
$0004$ Creates a managed grid control as a row heading.
$0008$ Allows users to resize grid columns.
$0010$ Sets the grid to be initially invisible. The grid can be made visible with the following command: print(sysgui) 'show'(id)
$0020$ Draws vertical lines between columns in Visual PRO/5 2.0x. In Visual PRO/5 2.10 and higher, use flag $8000$ to draw vertical lines. The default behavior in Visual PRO/5 2.10 and higher is for this flag to do nothing. However, if the 2.10 backward compatibility SETOPTS bit (byte 7, bit $08$) is set, this flag will cause vertical lines to be drawn.
$0040$ Draws horizontal lines between rows.
$0080$ Includes a horizontal scroll bar with the control.
$0100$ Includes a vertical scroll bar with the control.
$0800$ Creates a three-dimensional recessed client edge around the control. Note that the client edge is displayed inside the control's bounding rectangle, slightly reducing the visible area of the grid.
$1000$ Creates a three-dimensional raised edge around the control. Note that the raised edge is displayed inside the control's bounding rectangle, slightly reducing the visible area of the grid.
$8000$ Draws vertical lines between columns.
rows Set the number of rows.
columns Set the number of columns.

Return Value

Returns the created BBjGrid object.

Remarks

By default, the grid will have 3 rows and 3 columns.

In BBj 23.00 and higher, if the ID parameter is not specified, a control ID is assigned dynamically using getAvailableControlID().

In BBj 23.00 and higher, if the x, y, width, and height parameters are not specified, they are all initialized to 0. This is typically for use with DWC windows that dynamically arrange their contents (window creation flag $00100000$).

Example

rem ' BBjWindow::addGrid

sysgui = unt
open (sysgui)"X0"
sysgui! = bbjapi().getSysGui()
window! = sysgui!.addWindow(25,25,400,400,"BBjGrid",$00090083$)
window!.setCallback(window!.ON_CLOSE,"eoj")
grid! = window!.addGrid(101,25,25,350,350,$8060$,4,2)
grid!.setCallback(grid!.ON_GRID_CELL_MODIFY,"modify")
grid!.setEditable(1)
grid!.setDefaultColumnWidth(130)
grid!.setRowHeight(30)
for row = 0 to 3
    for col = 0 to 1
        celltext$ = "row=" + str(row) + ",col=" + str(col)
        grid!.setCellText(row,col,celltext$)
    next col
next row
process_events

eoj:
release

modify:
    event! = sysgui!.getLastEvent()
    print event!.getEventName(),event!.getRow(),event!.getColumn()," ",event!.getEditText()
return

See Also

BBjAPI

BBjSysGui

BBjControl

BBjWindow

`GRID' Mnemonic

Grid Callbacks

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