Adding Component Editors

From RAD Studio
Jump to: navigation, search

Go Up to Making Components Available at Design Time

Component editors determine what happens when the component is double-clicked in the designer and add commands to the context menu that appears when the component is right-clicked. They can also copy your component to the Windows clipboard in custom formats.

If you do not give your components a component editor, Delphi uses the default component editor. The default component editor is implemented by the class TDefaultEditor. TDefaultEditor does not add any new items to a component's context menu. When the component is double-clicked, TDefaultEditor searches the properties of the component and generates (or navigates to) the first event handler it finds.

To add items to the context menu, change the behavior when the component is double-clicked, or add new clipboard formats, derive a new class from TComponentEditor and register its use with your component. In your overridden methods, you can use the Component property of TComponentEditor to access the component that is being edited.

Adding a custom component editor consists of the steps: