Interface CommonGrid::setColumnStyle

Description

Sets the default style of a column in the BBjGrid.

Syntax

Return Value

Method

void

setColumnStyle(int column, int style)

Parameters

Variable

Description

column

Specifies the 0-based column.

style

Specifies one of the values listed below:

 

Style Value Constants:

 

 

GRID_STYLE_BUTTON_DOWN

Recessed button

 

GRID_STYLE_BUTTON_UP

Raised button

 

GRID_STYLE_CHECKED

Checked checkbox

 

GRID_STYLE_INPUTD

InputD

 

GRID_STYLE_INPUTE

InputE

 

GRID_STYLE_INPUTN

InputN

 

GRID_STYLE_PASSWORD

Password edit box

 

GRID_STYLE_TEXT

Text field

 

GRID_STYLE_UNCHECKED

Unchecked checkbox

Return Value

None.

Remarks

By default, the default cell style is GRID_STYLE_INPUTE. Cell styles GRID_STYLE_TEXT support HTML tags.

Example

rem ' gridedit.txt

sysgui = unt
open (sysgui)"X0"
sysgui! = bbjapi().getSysGui()
window! = sysgui!.addWindow(50,50,500,300,"Grid Editing",$00090003$)
window!.setCallback(window!.ON_CLOSE, "eoj")
grid! = window!.addGrid(101,10,10,480,280,$8060$,10,6)
grid!.setEditable(1)
grid!.setHasColumnHeader(1)
grid!.setColumnHeaderCellText(0,"Line")
grid!.setColumnWidth(0,50)
grid!.setColumnStyle(0,grid!.GRID_STYLE_INPUTN)
grid!.setColumnMask(0,"##0")
grid!.setColumnHeaderCellText(1,"Part")
grid!.setColumnWidth(1,80)
grid!.setColumnStyle(1,grid!.GRID_STYLE_INPUTE)
grid!.setColumnHeaderCellText(2,"Description")
grid!.setColumnStyle(2,grid!.GRID_STYLE_TEXT)
grid!.setColumnEditable(2,0)
grid!.setColumnWidth(2,100)
grid!.setColumnHeaderCellText(3,"Qty")
grid!.setColumnWidth(3,60)
grid!.setColumnStyle(3,grid!.GRID_STYLE_INPUTN)
grid!.setColumnMask(3,"###,##0-")
grid!.setColumnHeaderCellText(4,"Price")
grid!.setColumnWidth(4,80)
grid!.setColumnStyle(4,grid!.GRID_STYLE_INPUTN)
grid!.setColumnMask(4,"$###,###.00-")
grid!.setColumnHeaderCellText(5,"Ext")
grid!.setColumnWidth(5,100)
grid!.setColumnStyle(5,grid!.GRID_STYLE_INPUTN)
grid!.setColumnMask(5,"$###,###.00-")
grid!.setRowHeight(20)
grid!.setTabAction(grid!.GRID_NAVIGATE_GRID)
grid!.setCallback(grid!.ON_GRID_SELECT_COLUMN,"col")
edit! = window!.addEditBox(201,0,0,0,0,$$,$$)
cedit! = window!.addCEdit(202,0,0,160,160,"",$8116$)
cedit!.setCallback(cedit!.ON_LOST_FOCUS,"focus")
edit! = window!.addEditBox(203,0,0,0,0,$$,$$)
grid!.focus()
grid!.startEdit(0,0)
process_events

eoj:
release

row:
    event! = sysgui!.getLastEvent()
    row = event!.getRow()
    print "row",row
return

col:
    event! = sysgui!.getLastEvent()
    row = event!.getRow()
    col = event!.getColumn()
    print "col",col
    if col<>2 then return
    text$ = grid!.getCellText(row,col)
    rect! = event!.getCellBounds()
    cedit!.setText(text$)
    cedit!.setLocation(grid!.getX()++rect!.x,grid!.getY()+grid!.getColumnHeaderHeight()++rect!.y)
    cedit!.setVisible(1)
    cedit!.focus()
return

focus:
    event! = sysgui!.getLastEvent()
    text$ = cedit!.getText()
    grid!.setCellText(row,col,text$)
    cedit!.setVisible(0)
    switch window!.getFocusedControlID()
        case 201; grid!.startEdit(row,1); break
        case 203; grid!.startEdit(row,3); break
    swend
return

See Also

BBjAPI

BBjSysGui

BBjControl

BBjWindow

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