BBjGrid::setTopRow

Description

Sets a row to be the top visible row in the BBjGrid.

Syntax

Return Value Method
void setTopRow(int row)

Parameters

Parameter Description
row Specifies the 0-based row.

Return Value

None.

Remarks

If the number of rows in a grid fit within the visible area of the grid, then the top row cannot be set to anything greater than 0. The number of rows will be ignored if set to a higher value.

Note:

For grids that are set to have more rows than can fit in the display area; the bottom row of the grid will never be scrolled higher than the bottom of the visible area in the grid. Therefore, if the top row is set to a row that would move the bottom row above the bottom of the visible area, the top row will be set to the next highest row that will still have the bottom row at the bottom of the visible area.

Example

rem 'Set visible columns and rows of a BBjGrid

sysgui = unt
open (sysgui)"X0"
sysgui! = bbjapi().getSysGui()
window! = sysgui!.addWindow(50,50,500,400,"BBjGrid",$00090083$)
window!.setCallback(window!.ON_CLOSE, "eoj")
rows=10
cols=10
grid! = window!.addGrid(101,10,10,480,280,$81e0$,rows,cols)
grid!.setEditable(1)
grid!.setHasColumnHeader(1)
for col = 0 to cols-1
  grid!.setColumnHeaderCellText(col,str(col))
next col

grid!.setColumnHeaderCellText(0,"Line (0)")
grid!.setColumnWidth(0,80)
grid!.setColumnStyle(0,grid!.GRID_STYLE_TEXT)
grid!.setColumnHeaderCellText(1,"Description (1)")
grid!.setColumnWidth(1,420)
grid!.setColumnStyle(1,grid!.GRID_STYLE_TEXT)
grid!.setColumnHeaderCellText(2,"Color (2)")
grid!.setColumnWidth(2,80)
grid!.setColumnStyle(2,grid!.GRID_STYLE_TEXT)
grid!.setColumnHeaderCellText(3,"Text (3)")
grid!.setColumnWidth(3,80)
grid!.setColumnStyle(2,grid!.GRID_STYLE_TEXT)
grid!.setRowHeight(35)
grid!.setSnapToRowHeight(1)
for row = 0 to rows-1
  grid!.setCellText(row,0,str(row:"##0"))
next row

setLeftColumn! = window!.addButton(102,10,300,150,25,"setLeftColumn")
setLeftColumn!.setCallback(setLeftColumn!.ON_BUTTON_PUSH,"setLeftColumn")
setColumnVisible! = window!.addButton(103,175,300,150,25,"setColumnVisible")
setColumnVisible!.setCallback(setColumnVisible!.ON_BUTTON_PUSH,"setColumnVisible")
column! = window!.addInputNSpinner(104,375,300,100,25,$$,"#0",0,cols-1)
setTopRow! = window!.addButton(105,10,350,150,25,"setTopRow")
setTopRow!.setCallback(setTopRow!.ON_BUTTON_PUSH,"setTopRow")
setRowVisible! = window!.addButton(106,175,350,150,25,"setRowVisible")
setRowVisible!.setCallback(setRowVisible!.ON_BUTTON_PUSH,"setRowVisible")
row! = window!.addInputNSpinner(107,375,350,100,25,$$,"#0",0,rows-1)
process_events
process_events

eoj:
release

setLeftColumn:
column = column!.getValue()
grid!.setLeftColumn(column)
return
setColumnVisible:
column = column!.getValue()
grid!.setColumnVisible(column)
return
setTopRow:
row = row!.getValue()
grid!.setTopRow(row)
return
setRowVisible:
row = row!.getValue()
grid!.setRowVisible(row)
return

See Also

BBjAPI

BBjSysGui

BBjControl

BBjWindow

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