BBjGrid::setInsertMode

Description

In BBj 5.00 and higher, this method controls whether the editor is in insert mode.

Syntax

Return Value

Method

void

setInsertMode(int shouldInsert)

Parameters

Variable

Description

shouldInsert

Indicates whether editors should be placed in insert mode

Return Value

None.

Remarks

If in the insert mode, then characters are inserted into the cell when typed. Otherwise, the characters are overwritten.

By default, the control is not in the insert mode.

Example

rem 'set insert mode when editing in a BBjStandardGrid object

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=350
HEIGHT=160
TITLE$="BBj Window"

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,25,300,100,$8060$,4,2)
setInsertButton!=myWindow!.addButton(102,140,120,90,30,"OVERSTRIKE",$$)

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

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
CALLBACK(ON_CLOSE,APP_CLOSE,mySysGui!.getContext())
CALLBACK(ON_BUTTON_PUSH,CHANGE_INSERT_MODE,mySysGui!.getContext(),setInsertButton!.getID())

rem 'Process Events
process_events

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

CHANGE_INSERT_MODE:
    if myGrid!.getInsertMode() = 0
        myGrid!.setInsertMode(1)
        setInsertButton!.setText("Insert")
    else
        myGrid!.setInsertMode(0)
        setInsertButton!.setText("OverStrike")
    endif
return

See Also

BBjAPI

BBjSysGui

BBjControl

BBjWindow

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