Which custom module class are you registering for your frame?
Which version of Delphi are you using?
From my experiments with Delphi 2007, the custom module class which seems to work is TFrameModule. This class is contained in delphivclide100.bpl. Since there is no corresponding delphivclide.dcp you have to load it manually:
unit FrameTestReg;
interface
procedure Register;
implementation
uses
Windows, DesignIntf,
FrameTest;
procedure Register;
var
delphivclide: THandle;
TFrameModule: TCustomModuleClass;
begin
delphivclide := GetModuleHandle('delphivclide100.bpl');
if delphivclide <> 0 then
begin
TFrameModule := GetProcAddress(delphivclide, '@Vclformcontainer@TFrameModule@');
if Assigned(TFrameModule) then
RegisterCustomModule(TTestFrame, TFrameModule);
end;
end;
end.
My FrameTest unit is very simple, it has no FrameTest.dfm, only the declaration of the new TFrame descendant:
unit FrameTest;
interface
uses
Forms;
type
TTestFrame = class(TFrame)
private
FHello: string;
published
property Hello: string read FHello write FHello;
end;
implementation
end.
Using TFrameModule class, everything seems to work fine so far. I can create a new descendant of TTestFrame to include in the project and edit its published properties in the Object Inspector, put instances of this new descendant on a form in the IDE, edit their new published properties in the Object Inspector, write event handlers for their child components etc. In the .dfm resource I can see the expected "inline" directive for the instances.
I haven't encountered any problem with it so far so perhaps this is the solution.
The IDE's main form is Application.MainForm. My quick test design package:
procedure DoStuff(Form: TCustomForm);
var
S: string;
begin
S := Form.Caption;
Form.Caption := S + ' - this one';
try
ShowMessage(Format('%s [%s] on monitor %d', [Form.Name, Form.ClassName, Form.Monitor.MonitorNum]));
finally
Form.Caption := S;
end;
end;
initialization
DoStuff(Application.MainForm);
This in my case displays "AppBuilder [TAppBuilder] on monitor 0" and I can see the " - this one" suffix in the main form's caption.
What doesn't seem to work in your case?
Best Answer
This should work whether the property inspector is docked or not, since it falls back to the main form for the docked case: