Double click on a non-visual component
Possible duplicate:
How to invoke the property editor at design time
I am creating a non-visual component and I want the user to be able to double click my component at design time and open the design time editor.
How can i do this?
source to share
Double-clicking a component at design time brings up the component editor. The default component editor is one that looks for event properties with specific names and creates a handler for what it finds. You can write your own component editor to do whatever you want.
Create a child TComponentEditor
(from the DesignEditors block) and override Edit
to handle double clicks. You can also override the GetVerbCount
, GetVerb
and methods ExecuteVerb
to add context menu items to your component. To get a link to the component that your editor is editing, check the property Component
. Call Designer.Modified
if your editor modifies a component.
Tell the IDE that your editor should be used with your component by calling RegisterComponentEditor
(from DesignIntf) in your procedure Register
.
You should place this code in a design-time package, separate from your component code. Place the runtime package in the "Required" list of the design-time package. If you put everything in one package, then consumers of your component won't be able to use runtime packages in their projects; they are not allowed to distribute your design-time package dependencies, which are only for use in the IDE.
source to share