Column adding and copying

TreeGrid documentation

new 12.0 <Cfg> int

ColAdding

[0]
If it is possible to add new columns to grid, bit array for the column sections.
1 - middle columns, 2 - right columns, 4 - left columns. Set to 7 for all sections.
By default it is disabled!
new 12.0 <Cfg> int

ColCopying

[7]
If it is possible to copy (duplicate) columns in grid, bit array for the column sections.
1 - middle columns, 2 - right columns, 4 - left columns.
It is disabled if set ColAdding='0'.
By default it is enabled, but copying is disabled due default ColAdding='0'!
new 12.0 <C> int

CanCopy

[2/1/0]
If the column can be copied. 0 - no, 1 - inside its section, 2 also outside its section.
By default it is 0 for Panel, Index, Gantt and ConstWidth columns, 1 for columns added by AutoCols, and 2 for all other columns.
new 12.0 API method TCol[]

AddCols

(string[] cols, string tocol, bool right, bool empty = 0, bool focus = 0)
Adds or copies one or more columns to grid.
cols can be an array of columns to be copied.
Or the cols can be a number of new columns to add.
tocol is column next to place the new columns, left if right is 0 or right if right is 1.
Or the tocol can be a column section (0 - left, 1 middle, 2 right) where to place the new columns. To beginning, if right is 0, or to end, if right is 1.
If empty is 1, copies the columns empty or with the EditAttrsEmpty if set.
If focus is 1, focuses the new columns in the same row(s) as the original focus.
Returns the new added columns.
new 12.0 API event bool

OnColsAdd

(TGrid grid, string[] cols, string tocol, bool right, bool empty)
Called when new or copied columns are added to grid. Return true to suppress the action.
It is called from AddCols method and the parameters are the same.
chg 7.0 API method TCol

AddCol

(string col, int sec, int pos, object param, bool show = 0, string type = "Text", string caption = col)
Adds one new column to the table.
col is column name, sec is section of columns (0 - left, 1 - mid, 2 - right), pos is column position in its section (from 0). -1 for the last column.
param (new in 7.0) is an object with all parameters like for <C> tag, to preset them in the column, for example { Width:100, Type:"Lines", CanSort:0 }
Before 7.0 version the param was integer and specified column width, it is still supported, but not recommended.
for show = 1 is column displayed in table, for show = 0 it is hidden and can be displayed by ShowCol method.
type is set column Type attribute (just for backward compatibility, it can be set in param), caption is string displayed in all headers for this column.
New column will have default values from <D Name='C'>.
Returns new column or null if column with given name already exists.
new 12.0 <Actions>

AddCol ...F

Attached to OnClickButtonAddCol and used in Toolbar AddCol and Panel Menu
Adds one new column left to the actual or focused column.
new 12.0 <Actions>

AddColNext ...F

Not attached to any event
Adds one new column right to the actual or focused column.
new 12.0 <Actions>

AddColEnd

Attached to OnClickButtonAddCol and used in Toolbar AddCol Menu
Adds one new column on the end of variable columns section.
It always creates brand new column and ignores EditAttrEmpty attribute.
new 12.0 <Actions>

AddCols ...F

Not attached to any event, but used in Toolbar AddCol Menu
Adds the same number of new columns as actually focused columns, left to actual column or focused range.
new 12.0 <Actions>

AddColsNext ...F

Not attached to any event
Adds the same number of new columns as actually focused columns, right to actual column or focused range.
new 12.0 <Actions>

AddSelectedCols ...F

Not attached to any event, but used in Toolbar AddCol Menu
Adds the same number of new columns as actually selected columns, left to the actual or focused column.
new 12.0 <Actions>

AddSelectedColsNext ...F

Not attached to any event
Adds the same number of new columns as actually selected columns, right to the actual or focused column.
new 12.0 <Actions>

CopyCol ...F

Not attached to any event, but used in Toolbar AddCol Menu
Copies actual or focused column to the left side of itself.
new 12.0 <Actions>

CopyColNext ...F

Not attached to any event
Copies actual or focused column to the right side of itself.
new 12.0 <Actions>

CopyCols ...F

Not attached to any event, but used in Toolbar AddCol Menu
Copies all focused columns to the left side of actual column or the focused range.
new 12.0 <Actions>

CopyColsNext ...F

Not attached to any event
Copies all focused columns to the right side of actual column or the focused range.
new 12.0 <Actions>

CopySelectedCols ...F

Not attached to any event, but used in Toolbar AddCol Menu
Copies all selected columns to the left side of actual or focused column.
new 12.0 <Actions>

CopySelectedColsNext ...F

Not attached to any event
Copies all selected columns to the right side of actual or focused column.
new 12.0 <Actions>

ColCopy

Attached to OnCtrlDragHeader, can be attached only to OnDrag... event
Starts copying column by mouse dragging.
The columns can be copied inside Header or placed to DropCols cells.
new 12.0 <Actions>

ColCopySelected

Attached to OnCtrlDragHeader, can be attached only to OnDrag... event
Starts copying selected columns by mouse dragging. Fails if actual column is not selected.
The columns can be copied only inside Header. Ignores Block attributes.