rem ' BBjGrid::setPagingAmount
sysgui! = bbjapi().openSysGui("X0")
window! = sysgui!.addWindow(50,50,800,600,"BBjGrid::setPagingAmount",$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
|