BBjGrid::setEditOnKeyPress

Description

In BBj 19.00 and higher, this method sets a flag to enable or disable the ability to edit cells directly on a keypress.

Syntax

Return Value

Method

void

setEditOnKeyPress(boolean p_value)

Parameters

Variable

Description

p_value

A boolean which specifies whether editing on keypress is enabled ("true") or disabled ("false").

Return Value

None.

Remarks

By default, editing on keypress is disabled. A value of "true" enables the grid to start editing on keypress, and the default value of "false" disables this functionality.

When set to "true", pressing the up or down arrow keys while editing stops editing and saves the existing text inside the cell. Pressing Esc while editing also stops editing but reverts the cell to its previous text value.

Example

rem ' BBjGrid::setEditOnKeyPress Example

gui! = BBjAPI().openSysGui("X0")
wnd! = gui!.addWindow(gui!.getAvailableContext(),100,50,500,400,"Grid Test")
grd! = wnd!.addGrid(wnd!.getAvailableControlID(),32,24,252,133)

rem 'grd!.setEnhancedSelectionModelEnabled(1)
grd!.setNumColumns(2)
grd!.setRowHeight(30)
grd!.setEditable(1)
grd!.setFitToGrid(BBjGrid.AUTO_RESIZE_NEXT_COLUMN)

vec! = new BBjVector()
vec!.addItem("1")
vec!.addItem("Item 1")
vec!.addItem("2")
vec!.addItem("Item 2")
vec!.addItem("3")
vec!.addItem("Item 3")

grd!.setNumRows(3)
grd!.setCellText(vec!)

grd!.setEditOnKeyPress(1)
print grd!.isEditOnKeyPress()

wnd!.setCallback(wnd!.ON_CLOSE,"close")

process_events

close:
release

See Also

BBjGridCell

BBjGrid::isEditOnKeyPress