Documents

NextGrid & NextDBGrid

NextGrid

NextDBGrid

NextInspector

NextSheet

NextCollection

Misc

Labs

NextGrid .NET

Using Editors in runtime

Related Articles:

Info
  • Skill:
  • Version: 1.0.0
  • Author: Bojan Nikolic
  • Created: 2009-08-26
  • Updated: 2009-08-31

Content:


1. Introducing
2. First Samples
3. Type Casting
4. InplaceEdit property


1. Introducing



Textual Columns in NextGrid and NextDBGrid such as TNxTextColumn, TNxNumberColumn own a Editor object, which represent Inplace-Editor for this column.

By using Editor object we may additionally customize Edit, SpinEdit, ComboBox... before cell enter into edit state.

2. First Samples



Since Editor object is property of column, we may simply access to it:

NextGrid1.Columns[4].Editor...


NextGrid1->Columns[4]->Editor...


Events such as OnBeforeEdit or OnApplyEditText are ideal for fine tuning your Editor.

3. Type Casting



Editor object is created from TNxCustomEdit class which give a possibility for using other TNxCustomEdit descendants as TNxComboBox, TNxSpinEdit...

Accessing TNxCustomEdit properties is simple by using next code:

NextGrid1.Columns[0].Color := clRed;


NextGrid1->Columns->Item[0]->Color := clRed;


For accessing to class specific properties and methods typecasting must be used:

TNxSpinEdit(NextGrid1.Columns[0].Editor).Max := 200;


((TNxSpinEdit*)(NextGrid1->Columns->Item[0]->Editor))->Max = 200;


4. InplaceEdit property



Each column in NextGrid and NextDBGrid include a InplaceEdit property which may be attached to the edit control from Next Editor component palette such as TNxEdit, TNxSpinEdit...

Edit control may be customized and when grid enters into edit state, edit will be used a cell Inplace Editor.

BorderStyle property of edit control in most cases need to be set to bsNone to exclude double border when cell is being edited.

Was This Article Useful?

Only constructive comments, code contributions... will be publishes. Questions, non-official discussion will not be published.