BBjGridHeader::setDefaultAlignment

Description

In BBj 5.0 and higher, sets the default alignment of this BBjGridHeader.

Syntax

Return Value

Method

void

setDefaultAlignment(int align)

Parameters

Variable

Description

align

Specifies the alignment of the cell (align value constants).

GRID_ALIGN_LEFT

GRID_ALIGN_RIGHT

GRID_ALIGN_CENTER

Return Value

None.

Remarks

By default, the alignment is GRID_ALIGN_CENTER.

Example

rem 'set the default alignment of cells in the grid

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$,$000002$)

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

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 'set the default alignment of all cells in the grid
myGrid!.setDefaultAlignment(myGrid!.GRID_ALIGN_LEFT)

rem 'get the default alignment of all cells in the grid
gridalignment=myGrid!.getDefaultAlignment()
if gridalignment=myGrid!.GRID_ALIGN_LEFT then print "grid is aligned to the left"
if gridalignment=myGrid!.GRID_ALIGN_CENTER then print "grid is aligned to the center"
if gridalignment=myGrid!.GRID_ALIGN_RIGHT then print "grid is aligned to the right"
rem 'Register the CALLBACK routines
CALLBACK(ON_CLOSE,APP_CLOSE,mySysGui!.getContext())

rem 'Process Events
process_events

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

See Also

BBjAPI

BBjSysGui

BBjControl

BBjWindow

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