BBjGrid::setBeepOnValidationFailure

Description

In BBj 6.0 and higher, this method sets whether a grid should beep when the application calls accept(0) during validation.

Syntax

Return Value

Method

void

setBeepOnValidationFailure(boolean p_shouldBeep)

Parameters

Variable

Description

p_shouldBeep

Indicates whether the grid should beep when the application calls accept(0) in response to a validation event.

Return Value

None.

Remarks

By default, a grid will beep when the application calls accept(0).

Example

rem 'set beep on validation failure

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,25,25,300,100,$8060$,7,2)

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

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

rem 'set control validation
myGrid!.setCausesControlValidation(1)

rem 'set beep on validation failure
myGrid!.setBeepOnValidationFailure(1)

rem 'Register the CALLBACK routines
CALLBACK(ON_CLOSE,APP_CLOSE,mySysGui!.getContext())
myGrid!.setCallback(myGrid!.ON_GRID_CELL_VALIDATION,"GRID_VALIDATION")

rem 'Process Events
process_events

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

GRID_VALIDATION:
    gvalue = NUM(myGrid!.getEditText())
    if (gvalue > 15) then
        myGrid!.accept(0)
    return
else
    myGrid!.accept(1)
return

fi

See Also

BBjAPI

BBjSysGui

BBjControl

BBjWindow

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