TcxGridTableView.CreateColumn Method
Creates a new column and adds it to the Columns collection.
Declaration
function CreateColumn: TcxGridColumn;
Returns
Type | Description |
---|---|
TcxGridColumn | The created column. |
Remarks
Call the CreateColumn
function to create a new unbound column. The Columns property provides indexed access to all columns in the unbound Table grid View.
Code Example: Create an Unbound Column
The following code example creates an unbound Table View column, assigns an in-place spin editor to it, and limits the editor’s input value range:
uses cxSpinEdit;
// ...
var
AColumn: TcxGridColumn;
ASpinEditProperties: TcxSpinEditProperties;
begin
AColumn := cxGrid1TableView1.CreateColumn; // Creates a new unbound column
AColumn.DataBinding.ValueType := 'Currency'; // Changes the column value type to "Currency"
AColumn.PropertiesClass := TcxSpinEditProperties; // Assigns an in-place spin editor
ASpinEditProperties := AColumn.Properties as TcxSpinEditProperties;
ASpinEditProperties.MinValue := 0; // Sets the minimum edit value
ASpinEditProperties.MaxValue := 1000; // Sets the maximum edit value
ASpinEditProperties.Circular := True; // Loops value changes within the defined range
end;
Grid Column Deletion
To delete a grid column, release it directly in code (call the Free procedure in Delphi or use the delete
keyword in C++Builder):
See Also