Table GridColumn
Column definition for Grid.
Summary
Field | Type | Summary |
---|---|---|
Caption | string | Caption in header, default is the alpha-identifier |
DefaultValue | Default value for this column on insertion of new row (line) in the grid | |
HorizontalAlign | integer | Horizontal alignment of displayed data in this column. |
ID | string | Alpha identifier of the column, Excel-like style: "A", "B", ... |
IsVisible | bool | Is column visible? |
OriginalWidth | number | Original width, the width given in Grid.AddColumn. |
VerticalAlign | integer | Vertical alignment of displayed data in this column. |
Return type | Function and summary |
---|---|
bool | 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. |
OnSelect(Dialog dialog, Grid grid, Map rowMap, GridColumn colArray) Function fired when a cell is selected in the column. |
Fields
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.
Functions
GridColumn.OnSelect(Dialog dialog, Grid grid, Map rowMap, GridColumn colArray)
Function fired when a cell is selected in the column.
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.
Parameter | Type | Default | Description |
---|---|---|---|
dialog | Dialog | The MyrScript Dialog object | |
grid | Grid | The grid | |
column | GridColumn | from which you can get the ID, caption and alignment properties.. | |
rowMap | Map | The row in a Map object, retrieve data by rowMap:get("my column") . | |
left | number | Left edge of the cell | |
top | number | Top edge of the cell | |
right | number | Right edge of the cell | |
bottom | number | 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)