BBjGrid::setPaging

Description

Sets whether the BBjGrid can be scrolled by paging buttons (Page Up and Page Down).

Syntax

Return Value Method
void setPaging(boolean paging)

Parameters

Parameter Description
page Specifies whether the grid can be scrolled by paging buttons. By default, page is set to false (0).
  • true (1) = The grid can be scrolled by paging buttons.
  • false (0) = The grid hides the paging buttons.

Return Value

None.

Remarks

By default, pressing page up and page down (or fn+up and fn+down, respectively) scrolls the grid by the calculated paging amount, BBjGrid::setVisibleRows - 1.

In the GUI client alone, setting paging to true with BBjGrid::setPaging adds paging buttons (Page Up and Page Down) and allows for changing the paging to a specific amount with BBjGrid::setPagingAmount.

If enabled, the Page Down button (Page Down) appears at the intersection of the vertical and horizontal scroll bars. The Page Up button (Page Up) only appears if the grid has a column header, and appears at the right edge of the column header area, immediately above the vertical scroll bar.

Note:

Since the paging buttons interact with the scroll bars, enabling paging automatically enables both scroll bars.

  • If on the top row, clicking Page Up or page up scrolls up by the paging amount; otherwise, it moves to the top row without scrolling.
  • If on the bottom row, clicking Page Down or page down scrolls down by the paging amount; otherwise, it moves to the bottom row without scrolling.

Example

rem ' BBjGrid::setPaging

sysgui! = bbjapi().openSysGui("X0") 
window! = sysgui!.addWindow(50,50,800,600,"BBjGrid::setPaging",$80090083$) 
window!.setCallback(window!.ON_CLOSE,"eoj")
window!.setCallback(window!.ON_RESIZE,"resize")

window!.getDrawPanel().drawLine(10,25,10,525)

status! = window!.addStatusBar(99)

grid! = window!.addGrid(101,25,25,750,500,$8048$,100,20)
grid!.setLineColor(BBjColor.LIGHT_GRAY)
grid!.setDefaultColumnWidth(100)
grid!.setSnapToRowHeight(0)
grid!.setRowHeight(25)
grid!.setCallback(grid!.ON_GRID_SELECT_ROW,"status")

for row=0 to grid!.getNumRows()-1
  for col=0 to grid!.getNumColumns()-1
    grid!.setCellText(row,col,str(row)+","+str(col))
  next col
next row

for col=0 to grid!.getNumColumns()
  grid!.setColumnHeaderCellText(col,str(col))
next col

snap! = window!.addCheckBox(102,25,550,120,25,"Snap to height",$$)
snap!.setToolTipText("BBjGrid::setSnapToRowHeight")
snap!.setCallback(snap!.ON_CHECK_CHANGE,"snap")

paging! = window!.addCheckBox(103,150,550,70,25,"Paging",$$)
paging!.setToolTipText("BBjGrid::setPaging")
paging!.setCallback(paging!.ON_CHECK_CHANGE,"paging")

amount! = window!.addInputNSpinner(104,225,550,95,25,$$,"-##0",$$,-1,-1,-1,99)
amount!.setToolTipText("BBjGrid::setPagingAmount (-1=BBjGrid::getVisibleRows()-1)")
amount!.setCallback(amount!.ON_SPIN,"amount")

colheader! = window!.addCheckBox(105,325,550,120,25,"Col Header",$$)
colheader!.setToolTipText("BBjGrid::setHasColumnHeader")
colheader!.setCallback(colheader!.ON_CHECK_CHANGE,"colheader")

vscroll! = window!.addCheckBox(106,450,550,120,25,"Vertical Scroll",$$)
vscroll!.setToolTipText("BBjGrid::setVerticalScrollable")
vscroll!.setCallback(vscroll!.ON_CHECK_CHANGE,"vscroll")

hscroll! = window!.addCheckBox(107,575,550,120,25,"Horizontal Scroll",$$)
hscroll!.setCallback(hscroll!.ON_CHECK_CHANGE,"hscroll")
hscroll!.setToolTipText("BBjGrid::setHorizontalScrollable")

process_events

eoj:
  release

resize:
  event! = sysgui!.getLastEvent()
  status!.setText(event!.getEventName())
  width = event!.getWidth()
  height = event!.getHeight() + status!.getHeight()
  grid!.setSize(width-50,height-100)
  window!.getDrawPanel().clearDrawing()
  window!.getDrawPanel().drawLine(10,25,10,25+height-100)
  snap!.setLocation(snap!.getX(),height-50)
  paging!.setLocation(paging!.getX(),height-50)
  amount!.setLocation(amount!.getX(),height-50)
  colheader!.setLocation(colheader!.getX(),height-50)
  vscroll!.setLocation(vscroll!.getX(),height-50)
  hscroll!.setLocation(hscroll!.getX(),height-50)
  gosub status
return

snap:
  event! = sysgui!.getLastEvent()
  grid!.setSnapToRowHeight(event!.isChecked())
  gosub status
return

paging:
  event! = sysgui!.getLastEvent()
  grid!.setPaging(event!.isChecked())
  gosub status
return

amount:
  event! = sysgui!.getLastEvent()
  spin = num(event!.getText(),err=*return)
  grid!.setPagingAmount(spin)
  gosub status
return

colheader:
  event! = sysgui!.getLastEvent()
  grid!.setHasColumnHeader(event!.isChecked())
  gosub status
return

rowheader:
  event! = sysgui!.getLastEvent()
  grid!.setHasRowHeader(event!.isChecked())
  gosub status
return

vscroll:
  event! = sysgui!.getLastEvent()
  grid!.setVerticalScrollable(event!.isChecked())
  gosub status
return

hscroll:
  event! = sysgui!.getLastEvent()
  grid!.setHorizontalScrollable(event!.isChecked())
  gosub status
return

status:
  event! = sysgui!.getLastEvent()
  status$ = ""
  status$ = status$ + " Row " + str(grid!.getSelectedRow())
  status$ = status$ + " isPaging: " + Boolean.toString(grid!.isPaging())
  status$ = status$ + " getPagingAmount: " + str(grid!.getPagingAmount())
  if grid!.getPagingAmount() < 0 then
     status$ = status$ + " (" + str(grid!.getVisibleRows()-1) + ")"
  endif
  status$ = status$ + " getHasColumnHeader: " + Boolean.toString(grid!.getHasColumnHeader())
  status$ = status$ + " getVerticalScrollable: " + Boolean.toString(grid!.getVerticalScrollable())
  status$ = status$ + " getHorizontalScrollable: " + Boolean.toString(grid!.getHorizontalScrollable())
  print status$
  status!.setText(status$)
return

See Also

BBjAPI

BBjSysGui

BBjControl

BBjWindow

Methods of BBjGrid – Grid Scrolling

BBjGrid::isPaging

BBjGrid::getPagingAmount

BBjGrid::setPagingAmount

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