VCL.PropEdit Sample

From RAD Studio XE2 Code Examples
Jump to: navigation, search

Language:

This sample demonstrates how to create a property editor for a custom VCL component.

Contents

Location

You can find the PropEdit sample project at:

Description

This sample installs a custom pie chart component. The component has a property editor attached from which the angles of the pie can be adjusted at design time. The editor can be invoked either by double-clicking the pie on the form or by double-clicking the Angles property.

How to Use the Sample

  1. Navigate to Start > Programs > Embarcadero RAD Studio > Samples > Delphi > VCL > PropEdit and open pielib.dproj.
  2. Build and install pielib.bpl.

Files

File Contains

Pies

Contains the TPie component class and TAngles class.

PieReg

The classes and procedure necessary to create and register the property editor.

Classes

  • TPie is the class for the pie chart custom component.
  • TAngles implements the helper class designed to handle angle information for a pie chart.
  • TAngleEditorDlg is class for the form that represents the angles property editor.
  • TAnglesProperty, derived from TClassProperty, implements the Angles property for the pie component.
  • TPieEditor is the pie component editor, which is implemented to bring up the angle editor.

Implementation

  • TPieEditor.EditProperty overrides EditProperty to choose the angles property editor to be brought up when the component is double-clicked.
  • GetVerbCount, GetVerb, and ExecuteVerb are used to build the context menu for that component.
  • The Edit method of TAnglesProperty is responsible for bringing up the angles editor form.
  • Beside the Angles property, the pie component also has properties necessary for drawing itself on the form, like the brush and pen.

Uses

See Also

Personal tools
Previous Versions