I'm working on delphi XE2.
What I need:
I need MyFrame class with frame without any visible components, but with new event visible in Object Inspector. This event will inform my form (on which will be placed the MyFrame object), that f.e. all datas on the frame are fullfilled.
What I have:
Based on this post and the TOndrej's answer, and that hint, where Ba shows, that for XE2 we need to replace
delphivclide := GetModuleHandle('delphivclide160.bpl');
with this:
delphivclide := GetModuleHandle('vcldesigner160.bpl');
I have that code for new frame:
unit MyFrame;
interface
uses
System.Classes, Vcl.Forms;
type
TMyFrame = class(TFrame)
private
protected
FOnFilledData : TNotifyEvent;
public
published
property OnFilledData : TNotifyEvent read FOnFilledData write FOnFilledData;
end;
implementation
end.
And that code for the registration unit:
unit MyFrameReg;
interface
procedure Register;
implementation
uses Windows, DesignIntf, Dialogs, wFrame;
procedure Register;
var
delphivclide: THandle;
TFrameModule: TCustomModuleClass;
begin
delphivclide := GetModuleHandle('vcldesigner160.bpl');
if delphivclide <> 0 then
begin
TFrameModule := GetProcAddress(delphivclide, '@Vclformcontainer@TFrameModule@');
if Assigned(TFrameModule) then
begin
ShowMessage('I''m here');
RegisterCustomModule(TMyFrame, TFrameModule);
end;
end;
end;
end.
When i'll build my package, I have the message I'm here, so i supossed, that the MyFrame is registered.
What is my problem:
Problem is, that it dosn't work to the end.
When I choose New VCL Application, and want to create MyFrame by choosing File -> New -> Other -> Delphi Projects -> MyFrame then apears strange window showed below.
When I select some directory there and click the OK button, the new Delphi project is closed and my package project is opened.
I'll be very glad, if someone can advise me, what I've done wrong.