NextGrid & NextDBGrid








NextGrid .NET

Map VCL property to item

Related Articles:

  • Skill:
  • Version: 1.0.1
  • Author: Bojan Nikolic
  • Created:
  • Updated: 2008-05-24

1. Introducing

NextInspector can Set and Get properties of some other Component without a single line of code. Each item in NextInspector may control one property of associated Component.

Best practice for using this feature is to place NextInspector on form, add and customize Items. Then map some Items to desired inspector.

2. Connect with other Component

To do this, we need to set Associate property to point on some Component on Form (or created in Run-Time).

Starting from version 4.9 TPersistent objects are also supported.


Associate := Button1;

Associate = Button1;

3. Map Property to Item

After we have connect NextInspector with other Component, we can add items in NextInspector and MAP them to some property inside associated Component.

To map item to some property of associated Component, we use MapProperty property. Inside this property we need to place a Name of mapped property. Example:

MapProperty := 'Width';
MapProperty := 'Font.Size';
MapProperty := 'Color';
MapProperty := 'Constraints.MaxHeight';

After you set MapProperty, Caption property of item if is empty it will be automatically set to MapProperty.


NextInspector1.Associate = Edit1;
// 2nd item
NxTextItem2.MapProperty := 'Text';


4. Map property to the toolbar item

Toolbar Items (TNxToolbarItem) are ideal for set properies such as Font.Style, Anchors, BevelEdges or even Options property in NextInspector. User may click on Button in Toolbar Item and to set Flags of mapped property. All you have to do is to map Item to property and to add Buttons. One more thing you need to do is to set Text property of Buttons to desired flag.

4.1. Simple example


TMySet = set of (msOne, msTwo, msThree);

You need to add 3 Buttons and to set Text property for first button to msOne, for second to msTwo and for third to msThree.

4.2. Sset Toolbar Item for Font.Style property?

1. Place one TNextInspector (NextInspector1) and one TButton (Button1) component on Form
2. Set Associate Property of NextInspector1 to Button1.
3. Add First Category and one TNxFontStyleItem inside it. All is ok since TNxFontStyleItem is a TNxToolbarItem descendant.
4. Select this new added Toolbar Item in Items Editor
5. Set MapProperty to Font.Style
6. Click on button beside Button property of Item to open Buttons Editor.
7. Set Text property of Bold Button to fsBold, for Italic Button to fsItalic and for Underline to fsUnderline. This step is required

5. Enumeration property and TNxComboBoxItem

ComboBox Items are ideal for Enumeration properties like Align[code], [code]Visible or even Style Property of NextInspector. In Delphi IDE, all this inspector have Drop-down List when you click on it in ObjectInspector. To map Item to ENUM property, you need to manually add desired members of ENUM property into Lines property of ComboBox Item.


TPropertiesStyle = (psDefault, psOffice2003, psOffice2007, psWhidbey);

All you need is to click on button beside Lines property of Item and to add all this members inside.

We recommend downloading attached demo source for more details.

Was This Article Useful?

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