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

This feature is only supported in the GUI client.

By default, paging is disabled.

If paging is enabled, the page up button appears at the right edge of the column header area, immediately above the vertical scroll bar, and the page down button appears at the intersection of the vertical and horizontal scroll bars. Because the paging buttons interact with the scroll bars, enabling paging automatically enables both scroll bars. However, while the page up button depends on column headers, enabling paging does not automatically create column headers; they must be explicitly enabled to show the page up button.

The default paging amount is calculated as BBjGrid::getVisibleRows()-1. To select a specific paging amount, use BBjGrid::setPagingAmount.

If the current row is the top row, clicking the page up button scrolls up by the current paging amount. If the current row is not the top row, clicking the page up button moves to the top row without scrolling.

If the current row is the bottom row, clicking the page down button scrolls down by the current paging amount. If the current row is not the bottom row, clicking the page down button 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
Example Type: BBj

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.