rem ' BBjGrid::getColumnWidths
sysgui = unt
open (sysgui)"X0"
sysgui! = bbjapi().getSysGui()
sysgui!.setScale(1.5,1.5)
window! = sysgui!.addWindow(50,50,500,400,"getColumnWidths",$00090083$)
window!.setCallback(window!.ON_CLOSE,"eoj")
window!.setCallback(window!.ON_RESIZE,"resize")
rows = 10
cols = 10
grid! = window!.addGrid(101,25,25,450,320,$81ce$,rows,cols)
grid!.setLineColor(BBjColor.LIGHT_GRAY)
for col = 0 to cols-1
grid!.setColumnHeaderCellText(col,str(col))
grid!.setColumnWidth(col,50)
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,120)
grid!.setColumnStyle(1,grid!.GRID_STYLE_TEXT)
grid!.setColumnHeaderCellText(2,"Color (2)")
grid!.setColumnWidth(2,100)
grid!.setColumnStyle(2,grid!.GRID_STYLE_TEXT)
grid!.setColumnHeaderCellText(3,"Text (3)")
grid!.setColumnWidth(3,150)
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
getColumnWidths! = window!.addButton(1,25,350,150,25,"getColumnWidths")
getColumnWidths!.setCallback(getColumnWidths!.ON_BUTTON_PUSH,"getColumnWidths")
units! = window!.addCheckBox(2,200,350,150,25,"Units",$$)
status! = window!.addStatusBar(99)
print "getColumnWidths (defined units): ",grid!.getColumnWidths(1)
print "getColumnWidths (scaled pixels): ",grid!.getColumnWidths(0)
process_events
eoj:
release
resize:
event! = sysgui!.getLastEvent()
width = event!.getWidth() / sysgui!.getScaleX()
height = event!.getHeight() / sysgui!.getScaleY()
grid!.setSize(width-50,height-80)
getColumnWidths!.setLocation(25,height-50)
units!.setLocation(200,height-50)
return
getColumnWidths:
status!.setText(str(grid!.getColumnWidths(units!.isSelected())))
return
|