BBjGrid::getSnapToRowHeight

Description

In BBj 6.0 and higher, this method returns an indication of whether the gird will adjust its height so that only full rows appear in the grid.

Syntax

Return Value

Method

boolean

getSnapToRowHeight()

Parameters

None.

Return Value

Returns 0 or 1. If the return value is 1, the grid adjusts its height so that it does not display any 'partial' rows. If the return value is 0, the grid displays with the height specified by the program.

Remarks

None.

Example

rem 'Snap to Row Height example

rem 'Obtain the instance of the BBjAPI object
let myAPI!=BBjAPI()

rem 'Open the SysGui device
SYSGUI=UNT
OPEN (SYSGUI) "X0"

rem 'Obtain the instance of the BBjSysGui object
let mySysGui!=myAPI!.getSysGui()

rem 'Set addWindow param values
X=10
Y=10
WIDTH=400
HEIGHT=260
TITLE$="Snap to Row Height"

rem 'Set the current context
mySysGui!.setContext(0)

rem 'Create a window
myWindow! = mySysGui!.addWindow(X,Y,WIDTH,HEIGHT,TITLE$)

rem 'Add a grid on the window
myGrid! = myWindow!.addGrid(101,50,50,280,120,$8060$,10,3)
myButton! = myWindow!.addButton(102,140,190,90,30,"Snap On",$$)

rem 'Set the grid properties
myGrid!.setDefaultColumnWidth(130)
myGrid!.setGridEditable(1)
myGrid!.setVerticalScrollable(1)

rem 'Add text to the grid cells
FOR ROW = 0 TO 9
    FOR COL = 0 TO 2
        CELLTEXT$="ROW = " + STR(ROW+1) + ", COL = " + STR(COL+1)
        myGrid!.setCellText(ROW,COL,CELLTEXT$)
    NEXT COL
NEXT ROW

rem 'Register the CALLBACK routines
CALLBACK(ON_CLOSE,APP_CLOSE,mySysGui!.getContext())
myButton!.setCallback(myButton!.ON_BUTTON_PUSH,"SNAP_TO_ROW_HEIGHT")

rem 'Process Events
process_events

rem 'Callback routine called when the user closes the application window
APP_CLOSE:
release

SNAP_TO_ROW_HEIGHT:
    rem 'turn snapToRowHeight on or off based on button text
    if (MyButton!.getText() = "Snap on") then
        myGrid!.setSnapToRowHeight(1)
    else
        myGrid!.setSnapToRowHeight(0)
    endif

    rem 'set button text based on getSnapToRowHeight()
    if myGrid!.getSnapToRowHeight() then myButton!.setText("Snap off") else myButton!.setText("Snap on")
return

See Also

BBjAPI

BBjSysGui

BBjControl

BBjWindow

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