In Delphi 2009, in one of my projects, I have a custom frame with some controls that I want to use as a base class for some other controls. I want to register this frame as an IDE wizard, which will be available in the New Items list. When I add my new added item (my custom frame) to the project, I expect it to be:
- Show all properties and events that I added to the user frame in the object inspector.
- Output the newly created frame from my custom frame, not TFrame.
Well, to show my properties and events in the Object Inspector, I register the user module in the IDE. It does not work properly for frames. Fortunately, someone mentioned this on StackOverflow, and the answer is:
Display additional TFrame child properties in the object inspector
Then, to load the DFM of my custom frame, I added the InitInheritedComponent to my custom frame constructor. Something like that:
constructor TMyFrame.Create(AOwner: TComponent); override; begin inerited; if (ClassType <> TMyFrame) and not (csDesignInstance in ComponentState) then begin if not InitInheritedComponent(Self, TMyFrame) then raise EResNotFound.CreateFmt('Resource %s not found', [ClassName]); end; end;
This does not work! It still creates an empty constructor in the designer, and not in my own frame. If I do not register the user module in the IDE, it displays my frame correctly, without even requiring an InitInheritedComponent, but additional properties are not displayed in the Object Inspector!
if I change the constructor source to this (Replacing TMyFrame with TFrame):
constructor TMyFrame.Create(AOwner: TComponent); override; begin inerited; if (ClassType <> TFrame) and not (csDesignInstance in ComponentState) then begin if not InitInheritedComponent(Self, TFrame) then raise EResNotFound.CreateFmt('Resource %s not found', [ClassName]); end; end;
The frame was added to the constructor correctly, and additional properties are visible in the Object Inspector, but the application starts to fail because it complains that the components in the frame already exist.
So my question is: what is the solution for creating the Delphi IDE wizard, which creates a derived frame from a custom frame (not a form) with DFM and shows its additional properties in the Object Inspector?
By the way, I don’t want to create controls in the frame at runtime, because I need them to be available at design time as well.
I hope someone can make this clear to me.
Hello
Edition:
These frames are actually used as pages for the wizard component. My wizard component creates them at runtime. I want the user to have an option in the "New Item" menu to add a wizard page for the project, as well as design its layout in the IDE designer and register it using my wizard component, which will be shown in the wizard. I inherit the base class from TFrame because my wizard pages must have some required controls and some custom properties and events.