BBjGrid::setTabAction

Description

In BBj 5.00 and higher, this method sets the current tab action in the BBjGrid.

Syntax

Return Value

Method

void

setTabAction(int action)

Parameters

Actions must be one of the following constants.

GRID_NAVIGATE_COLUMN_THEN_CONTROL

Tab causes focus to move to the next column having width greater than zero. If focus is on the last visible* column, then Tab moves focus to the next control in Tab order.

Shift+Tab causes focus to move to previous visible* column. If focus is on the first visible* column, then Shift+Tab moves focus to the previous control in Tab order.

GRID_NAVIGATE_COLUMN_THEN_WRAP

Tab causes focus to move to next visible* column. If focus is on the last visible* column, then Tab moves focus to the first visible* column.

Shift+Tab causes focus to move to previous visible* column. If focus is on the first visible* column, then Shift+Tab moves focus to the last visible* column.

GRID_NAVIGATE_CONTROL

Tab causes focus to move to next control in Tab order. Shift+Tab causes focus to move to the previous control in Tab order.

GRID_NAVIGATE_GRID

Tab causes focus to move to the next visible* column. If focus is on the last visible* column, then Tab moves to the first cell in next row. If focus is on last column of last row, then focus moves to the first visible* cell of the first row.

Shift+Tab causes focus to move to the previous visible* column. If focus is on the first visible* column, then Shift+Tab moves to the last visible* column of previous row. If focus is on first visible* column of first row, then Shift+Tab moves focus to the last column of the last row.

GRID_NAVIGATE_LEGACY

In BBj 6.00 and higher, when editing the selected cell, this action behaves the same as GRID_NAVIGATE_COLUMN_THEN_CONTROL.

When not editing the selected cell, this action behaves as GRID_NAVIGATE_CONTROL.

*Visible column or cell has a width greater than zero

Return Value

None.

Remarks

By default, TabAction is GRID_NAVIGATE_COLUMN_THEN_CONTROL. If TabAction is set to GRID_NAVIGATE_COLUMN_THEN_WRAP or to GRID_NAVIGATE_GRID, then it is not possible to tab out of the grid.

Example

rem 'set tab action of the BBjGrid

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=400
TITLE$="BBj Window"

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

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

rem 'Add a grid on the window
myGrid! = myWindow!.addGrid(101,50,100,300,100,$8060$,4,2)

rem 'Add a button to the window
myButton!=myWindow!.addButton(102,50,200,280,30,"GRID_NAVIGATE_COLUMN_THEN_CONTROL",$$)

rem 'Set the grid properties
myGrid!.setDefaultColumnWidth(140)
myGrid!.setTabAction(myGrid!.GRID_NAVIGATE_COLUMN_THEN_CONTROL)

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

rem 'Register the CALLBACK routines
myWindow!.setCallback(myWindow!.ON_CLOSE,"APP_CLOSE")
myButton!.setCallback(myButton!.ON_BUTTON_PUSH,"BUTTON_PUSHED")

rem 'Process Events
process_events

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

BUTTON_PUSHED:
    SWITCH myGrid!.getTabAction()
        CASE 1; myButton!.setText("GRID_NAVIGATE_COLUMN_THEN_WRAP");myGrid!.setTabAction(myGrid!.GRID_NAVIGATE_COLUMN_THEN_WRAP);break
            CASE 2; myButton!.setText("GRID_NAVIGATE_CONTROL");myGrid!.setTabAction(myGrid!.GRID_NAVIGATE_CONTROL);break
                CASE 3;myButton!.setText("GRID_NAVIGATE_GRID"); myGrid!.setTabAction(myGrid!.GRID_NAVIGATE_GRID);break
                    CASE DEFAULT;myButton!.setText("GRID_NAVIGATE_COLUMN_THEN_CONTROL");myGrid!.setTabAction(myGrid!.GRID_NAVIGATE_COLUMN_THEN_CONTROL);swend
                    return

See Also

BBjAPI

BBjSysGui

BBjControl

BBjWindow

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