Downloads Articles Order Sign In
Welcome to Official Berg Software web site. Twelve years with you! All other websites providing Berg Software source code and content are illegal. We will not support users who use services, or buy products from illegal Berg Software websites. more...
  Home  
  News Archive  
  Components  
  Applications  
  Downloads  
  Order  
  Support  
  About  
 
  Components
  GridView
  DBGridView
  PropertiesView
  SheetView
  Comp. Collection
 
  Applications
  Berg Player
  SMS Mara Gateway
  Domain Binocular
 
 
  Support
  Contact Us
  Support forums
  Articles
 
 
 
MAP VCL PROPERTY TO ITEM Home > Articles > PropertiesView
Requirements: PropertiesView 2.4b or newer
See Also: Work with PropertiesView in Design-time , Work with PropertiesView in Run-time

Headlines:

1. Introducing
2. Connect with other Component
3. Map Property to Item
4. SET property and Toolbar Item
5. ENUMERATION property and TComboBoxItem

1. Introducing

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

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

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). Example:

Associate := Button1;

3. Map Property to Item

After we have connect PropertiesView with other Component, we can add some Items in PropertiesView and MAP them to some properties 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 will be automatically set to MapProperty (if Caption is empty).

4. SET property and Toolbar Item

Toolbar Items are ideal for SET properties such as Font.Style , Anchors , BevelEdges or even Options property in PropertiesView. 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.

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.

How to set Toolbar Item for Font.Style property:

  1. Place one TPropertiesView (PropertiesView1) and one TButton (Button1) component on Form
  2. Set Associate Property of PropertiesView1 to Button1.
  3. Add First Category and one TFontStyleItem inside it. TFontStyleItem is a TToolbarItem 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 TComboBoxItem

ComboBox Items are ideal for ENUMERATION Properties like Align , Visible or even Style Property of PropertiesView. In Delphi IDE, all this properties 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.

Example:

TPropertiesStyle = (psDefault, psOffice2003, 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.

if you have some comments please send us email to support@bergsoftware.net

 

Download

Map properties (RTTI) source.

rtti_source.zip
4 KB

 

 

 


 
Copyright © BergSoftware 1996 - 2009. All rights reserved.Contact Us.