creating a firemonkey component

后端 未结 1 1002
遥遥无期
遥遥无期 2021-01-27 07:39

I\'m working with Firemonkey in Delphi XE4 and I\'m unable to create a new component using the menu item Component -> New Component. Whether the component is a VCL or Firemonkey

相关标签:
1条回答
  • 2021-01-27 07:47

    Creating components is fairly straightforward in code.

    • Create a unit.
    • Add code for your component.
    • Add a Register procedure.

      procedure Register;
      begin
        RegisterComponents('NewPage', [TMyComponent]);
      end;
      
    • Add a declaration for Register in the implements section.

    • Add a call to RegisterFMXClasses in your initialization section.

      implementation
      uses FMX.Types;
      ...
      initialization
        RegisterFMXClasses([TMyComponent]);
      end.
      
    • Create a package.

    • Add the unit to the package.
    • Right-click the package (in the top-right panel) and select Install.

    (Note: It's usually best to create your component at run time whilst testing. You only need to do the package stuff once it's fairly stable).

    0 讨论(0)
提交回复
热议问题