Documents
NextGrid & NextDBGrid
- Upgrade existing projects for loading changes
- Edit events in NextGrid
- NextGrid Vista Style
- NextGrid How To
- Integrating Inplace Editors
- NextGrid Slide Style Tutorial
- InputLine Tutorial
- FieldChooser Tutorial
- Using Editors in runtime
- Grid Report Tutorial
- Html Column Tutorial
NextGrid
- NextGrid Quick Start
- Custom Draw in NextGrid
- Export to XML from NextGrid
- Optimize NextGrid
- NextGrid Custom Sorting
- VirtualColumn Tutorial
- Graphic Column Tutorial
- TreeColumn Tutorial
NextDBGrid
- NextDBGrid Quick Start
- NextDBGrid Events
- NextDBGrid How To
- Sorting records in NextDBGrid
- LookupColumn Tutorial
NextInspector
- NextInspector Advanced tutorial
- ToolbarItem tutorial
- NextDBInspector Tutorial
- NextInspector Item Types
- Map VCL property to item
- NextInspector Quick Start
NextSheet
NextCollection
- NxInfoPanel Tutorial
- Vista Styled Panels
- NxPathControl and NxNotebook tutorial
- NxPathControl Quick Start
- NxFlipPanel and NxHeaderPanel Quick Start
- NxOutlookBar Tutorial
- NxPageControl and NxNotebook Quick Start
- NxButton Tutorial
- NxAlertWindow Tutorial
Misc
- Numeric FormatMask
- NxVirtualDataSet tutorial
- DateTime FormatMask
- NxPreview Quick Start
- 32bit Bitmaps Tutorial
- Quick update
- Enable typing unicode characters in InplaceEditors
- Using NxColorScheme
- NxProgress Tutorial
- NxAutoCompletion Tutorial
- Component Names Change
- NxComboBox styles
Labs
NextGrid .NET
NextDBGrid Events
Related Articles:
Info
- Skill:
- Version: 1.0.1
- Author: Bojan Nikolic
- Created:
- Updated: 2008-04-22
OnApplyCell
This event occur when conten't value are goin to be drawn. Value is first reaeded from TField and then drawn. Between this 2 process OnApplyCell event occur and we may set that other value is drawn than one from TField.
| Name | Type | Meaning |
|---|---|---|
| ACol | Integer | Indicate Column Index of currently drawing cell. |
| ARow | Integer | Indicate Row Index of currently drawing cell. |
| Value | WideString | Determine or specify cell's drawing value. |
Usual scenario for using this event is reading Value parameter and adjust it additionally.
Another way may be using Field property (TField) of currently drawing column access to it and adjust Value parameter.
procedure TForm1.NextDBGrid1ApplyCell(Sender: TObject; ACol, ARow: Integer;
var Value: WideString);
var
Field: TField;
begin
Field := NextDBGrid1.Columns[ACol].Field;
if Field <> nil then
begin
if Field.AsString = '' then Value := '';
end;
end;
OnColumnCreate
This event occur when DataSet is activated and columns are added (doAddColumns flag must be True in DataAwareOptions). This is Point where class of newly added Column can be changed. Also adding column can be canceled.
Parameters:
| Name | Type | Meaning |
|---|---|---|
| Field | TField | Indicate TField in progress. When DataSet is activated, Next DBGrid add one column and occur this event for each TField in DataSet. |
| ColumnClass | TNxDBColumnClass | Column class of newly added Column. Using this parameter, column type can be changed. |
| AddColumn | Boolean | Default is True. When is set to False, column will NOT be added. |
As this event occur for each TField from DataSet when is activated, we may decide which field will have own column with grid, or change type of column. For example if default column are goin to be added TNxDBNumberColumn we may set ColumnClass property to be TNxDBImageColumn instead.
procedure TForm1.NextDBGrid1ColumnCreate(Sender: TObject; Field: TField; var ColumnClass: TNxColumnClass; var AddColumn: Boolean); begin if Field.FieldName = 'Progress' then ColumnClass := TNxDBProgressColumn; if Field.IsBlob then AddColumn = False; // Don't add column for BLOB fields end;
If AddColumn = True, [/code]OnColumnAdded[/code] event will occur next for this columns.
OnColumnAdded
This event occur when new Column is added after DataSet is activated. This is Point where new Column may be additionaly customized.
Parameters:
| Name | Type | Meaning |
|---|---|---|
| Column | TNxDBCustomColumn | Indicate newly added column. |
procedure TForm1.NextDBGrid1ColumnAdded(Sender: TObject;
Column: TNxDBCustomColumn);
begin
if Column is TNxDBCheckBoxColumn then
begin
with Column as TNxDBCheckBoxColumn do
begin
Alignment := taCenter;
ValueChecked := 'True';
ValueUnchecked := 'False';
Width := 50;
end;
end;
end;
In this example we have customize newly added CheckBox Column.
OnMeasuringRowHeight
This event occur in Cells drawing process, when Grid need to acquire Row Height. Default Value for each row is equal to property RowSize, but with using this event Row Height can be additionaly adjusted.
| Name | Type | Meaning |
|---|---|---|
| Index | Integer | Indicate Index of Row being drawn. |
| RowHeight | Integer | Gets or Sets Row Height of current Row. |
procedure TForm1.NextDBGrid1MeasuringRowHeight(Sender: TObject; Index: Integer; var RowHeight: Integer); begin if Index = 5 then RowHeight := 45; end;