BBjGrid::getVisibleColumnCount

In BBj 19.0 and higher, BBjGrid::getVisibleColumnCount is deprecated and replaced by BBjGrid::getVisibleColumns and BBjGrid::getMaxVisibleColumns.

Description

In BBj 15.0 and higher, this method returns the number of columns that are currently visible in the BBjGrid.

Syntax

Return Value

Method

int

getVisibleColumnCount()

Parameters

None.

Return Value

Returns the number of columns in the grid that are currently visible.

Example

rem 'VisbibleGridColumns

rem 'Displays visible grid details
rem 'Use the right & left arrow keys to scroll the grid
rem 'declare auto BBjAPI api!
declare auto BBjSysGui gui!
declare auto BBjWindow win!
declare auto BBjStandardGrid grid!
api!=BBjAPI()
gui! = api!.openSysGui("X0")
win! = gui!.addWindow(10,10,495,170,"Visible Grid Columns",$00010082$)
win!.setCallback(win!.ON_CLOSE,"APP_CLOSE")
grid! = win!.addGrid(101,102,103,10,10,475,164)
grid!.setRowHeight(15)
cols=30,rows=10
grid!.setNumColumns(cols)
grid!.setNumRows(rows)
grid!.setDefaultColumnWidth(50)
cells! = api!.makeVector()
for row=0 to rows-1
    for col=0 to cols-1
        cells!.addItem("C"+STR(col)+" R"+STR(row))
    next col
next row
grid!.setCellText(cells!)
grid!.setCallback(grid!.ON_GRID_SELECT_COLUMN,"STATUS")
print "Touch the Arrow Right key until at last column"
print "then touch the Arrow Left key until back at the first column",'lf'
gosub STATUS
grid!.focus()
process_events

STATUS:
    print "Current Cell: ",grid!.getSelectedCell()
    txt$="Visible Column Numbers: ",cnt=0,firstviscol=-1
    for col=0 to cols-1
        if (grid!.isColumnVisible(col)) then
            txt$=txt$+str(col)+" "
            cnt=cnt+1
            if firstviscol=-1 then firstviscol=col
        endif
    next col
    print txt$
    print "Number of Visible Columns using a loop:",cnt
    print "Number of Visible Columns using BBjGrid::getVisibleColumnCount(): ", grid!.getVisibleColumnCount()
    leftcol = grid!.getLeftColumn()
    print "Left Col#:",leftcol
    if cnt>10 print 'red',"More than 10 Visible Columns",'white'
    if leftcol <> firstviscol then ?'red',"First Visible Col# <> Left Col#",'white'
    print ""
return

APP_CLOSE:
release

See Also

BBjAPI

BBj Object Syntax

BBjSysGui

BBjControl

BBjWindow

BBj Object Diagram for an illustration of the relationship between BBjObjects.