Using Delphi XE3, I'm trying to add a published property to a form in such a way that when I open the form in the IDE, the property appears in the object inspector.
I've tried following the steps in this question and I think I've done them correctly, but the property does not appear.
What I've done so far:
- Create a new project with a new form, with the published property:
unit TestRegU;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs;
type
TfrmTestReg = class(TForm)
private
{ Private declarations }
FSampleProperty: Integer;
public
{ Public declarations }
published
property SampleProperty: Integer read FSampleProperty write FSampleProperty;
end;
var
frmTestReg: TfrmTestReg;
implementation
{$R *.dfm}
end.
- Create a new package. Inside the package, added a unit which registers the form using RegisterCustomModule:
unit RegItems;
interface
uses
Classes, DesignEditors, DesignIntf, TestRegU;
procedure Register;
implementation
procedure Register;
begin
RegisterNoIcon([TfrmTestReg]);
RegisterCustomModule(TfrmTestReg, TCustomModule);
end;
end.
- I've also added the form to the package:
package TestRegPkg;
{$R *.res}
{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users}
{$ALIGN 8}
{$ASSERTIONS ON}
{$BOOLEVAL OFF}
{$DEBUGINFO ON}
{$EXTENDEDSYNTAX ON}
{$IMPORTEDDATA ON}
{$IOCHECKS ON}
{$LOCALSYMBOLS ON}
{$LONGSTRINGS ON}
{$OPENSTRINGS ON}
{$OPTIMIZATION OFF}
{$OVERFLOWCHECKS OFF}
{$RANGECHECKS OFF}
{$REFERENCEINFO ON}
{$SAFEDIVIDE OFF}
{$STACKFRAMES ON}
{$TYPEDADDRESS OFF}
{$VARSTRINGCHECKS ON}
{$WRITEABLECONST OFF}
{$MINENUMSIZE 1}
{$IMAGEBASE $400000}
{$DEFINE DEBUG}
{$ENDIF IMPLICITBUILDING}
{$IMPLICITBUILD ON}
{$DESIGNONLY ON}
requires
rtl,
vcl,
designide;
contains
TestRegU in '..\TestRegPrj\TestRegU.pas' {frmTestReg},
RegItems in 'RegItems.pas';
end.
I successfully compile and install the package.
When I re-open the TfrmTestReg form, the property is not visible in the object inspector:
Any insight on what I'm missing would really help. Sample code here.