Table GridColumn

Column definition for Grid.

See
Grid.AddColumn
Grid.GetColumn
Grid.Columns

Summary

FieldTypeSummary
CaptionstringCaption in header, default is the alpha-identifier
DefaultValue Default value for this column on insertion of new row (line) in the grid
HorizontalAlignintegerHorizontal alignment of displayed data in this column.
IDstringAlpha identifier of the column, Excel-like style: "A", "B", ...
IsVisibleboolIs column visible?
OriginalWidthnumberOriginal width, the width given in Grid.AddColumn.
VerticalAlignintegerVertical alignment of displayed data in this column.
Return typeFunction and summary
boolOnDraw(Dialog dialog, Grid grid, GridColumn column, Map rowMap, number left, number top, number right, number bottom)
Function called before the content (text) of a cell of this column is drawn.
 OnSelect(Dialog dialog, Grid grid, Map rowMap, GridColumn colArray)
Function fired when a cell is selected in the column.

Fields

string GridColumn.ID

Alpha identifier of the column, Excel-like style: "A", "B", ...

"Z", "AA".

string GridColumn.Caption

Caption in header, default is the alpha-identifier

GridColumn.DefaultValue

Default value for this column on insertion of new row (line) in the grid

number GridColumn.OriginalWidth

Original width, the width given in Grid.AddColumn.

You can change this value after creation, but set it to nil may produce unexpected results.

  • If positive, width will be adjusted in proportion of sum of column widths, If "A"'s width is 1 and "B"'s width is 3, then "B" will be 3 times larger than "A".
  • If negative, width is fixed in pixels, -10 means 10 pixel large, useful for image column.

integer GridColumn.VerticalAlign

Vertical alignment of displayed data in this column.

Default is VERTICAL_ALIGN_MIDDLE

integer GridColumn.HorizontalAlign

Horizontal alignment of displayed data in this column.

See constants in MSDefine. Default is ALIGN_RIGHT for numbers, ALIGN_LEFT for strings.

bool GridColumn.IsVisible

Is column visible?

Default is true

Functions

GridColumn.OnSelect(Dialog dialog, Grid grid, Map rowMap, GridColumn colArray)

Function fired when a cell is selected in the column.

ParameterTypeDefaultDescription
dialogDialog The MyrScript Dialog object
gridGrid The grid
rowMapMap Map of columnNames to values
colArrayGridColumn Infos of the column, mainly colArray.ID and collArray.Name.

GridColumn.OnDraw(Dialog dialog, Grid grid, GridColumn column, Map rowMap, number left, number top, number right, number bottom)

Function called before the content (text) of a cell of this column is drawn.

It can change the foreground (text) color and return true to let Grid.OnDraw display the content, or it can transform the text, replace it by an image, and then return false to prevent from displaying textual content.

ParameterTypeDefaultDescription
dialogDialog The MyrScript Dialog object
gridGrid The grid
columnGridColumn from which you can get the ID, caption and alignment properties..
rowMapMap The row in a Map object, retrieve data by rowMap:get("my column").
leftnumber Left edge of the cell
topnumber Top edge of the cell
rightnumber Right edge of the cell
bottomnumber Bottom edge of the cell
Return
bool: true to continue displaying text content, false to prevent it.
See
DrawPicture
DrawText
Usage
myColumn.OnDraw = function(dialog, grid, column, rowMap, left, top, right, bottom)