Custom published property frames disappear when reopening the form file

I am using TFrame

as a base class for a composite component that is registered with the IDE. When I select a component from the palette and I add it to the shape / frame everything seems to work well. The next time I open the form / frame, the frame component will appear as a shared frame, for example, if the component is not registered from the IDE, I mean that:

  • All custom published properties are no longer visible in the Object Inspector

    .
  • Only published properties inherited from TFrame

    are still visible in Object Inspector

    .
  • Subcomponents can be clicked and moved within a frame. enter image description here

Also, if the property has a value, I get the following error:

Error reading MyComponent1.MyProperty: The property MyProperty does not exist. Ignore the error and continue? NOTE. Ignoring the error can remove components or lose property values.

Step by step:

  • I created and compiled the Designtime and Runtime package. (Note that using Delphi 2007 I got the TFrameModule class as described in this post by Ondrej Kelle ).

code:

  TMyComponent = class(TFrame)
  private
    FMyCaption : TCaption;
    { Private declarations }
  public
    { Public declarations }
  published
    property MyCaption : TCaption read FMyCaption write FMyCaption;
  end;

....

procedure Register;
var
  delphivclide: THandle;
  TFrameModule: TCustomModuleClass;
begin
  RegisterComponents('MyComponents', [TMyComponent]);

  //registering custom module for TMyComponent
  delphivclide := GetModuleHandle('delphivclide100.bpl');
  if delphivclide <> 0 then
  begin
    TFrameModule := GetProcAddress(delphivclide, '@Vclformcontainer@TFrameModule@');
    if Assigned(TFrameModule) then
      RegisterCustomModule(TMyComponent, TFrameModule);
  end;
end;

      

  • I added a folder containing files dcu

    and dcp

    so that Tools -> Options -> Library - Win32 -> Library path

  • I added the folder containing the file bpl

    to my environment variable PATH

    .

  • I installed the package in the IDE and restarted it.

  • I created a new Runtime package with a form where I placed the class component TMyComponent

    .

  • The component appears as expected and I set the property MyCaption

    to "AAA".enter image description here

  • Then I saved the form and closed the IDE.

  • After that I restarted the IDE, when reopening the same form file I got the following error: enter image description here

  • I also tried to follow the same steps without setting a value for the property and I noticed that the property disappears from Object Inspector

    :enter image description here

Additional Information:

  • The property MyCaption

    appears Object Inspector

    every time the component package is recompiled and reloaded IDE

    . I see it in Object Inspector

    until the next close and restart IDE

    , then it disappears again.

  • I reproduced the same problem using DelphiXE7 by passing "delphivclide210.bpl" instead of "delphivclide100.bpl" to a function GetModuleHandle

    in a procedure Register

    .

  • It doesn't look like OS, I have reproduced it on Windows 10 and Windows XP.

+3


source to share





All Articles