Step 1 - Create a Component Using the New Component Wizard

From Appmethod Topics
Jump to: navigation, search

Go Up to Creating a Styled FireMonkey Component by Extending an Existing Component

  1. Select Component > New Component.
  2. On the first page of the New Component wizard, select FireMonkey for Object Pascal:

    NewComponentPerson1.png
  3. On the Ancestor Component page, select TLabel as the ancestor of the new component:

    AncestorComponentStep.png
  4. On the Component page, enter TClockLabel as the name of the class. In the Unit name field, enter C:\Users\<your home directory>\My Documents\Appmethod\Projects\ClockLabel.pas as the name of a file to create:

    ComponentPage.png
    Note! Remember the specified path.
  5. On the Create Unit page, select Install to New Package:

    InstalltoNew.png
  6. On the New Package page, set ClockLabel as the name of the new package to generate:

    NewPackageClockLabel.png
  7. The wizard can open the Save '<UnitFile>' As dialog box asking for the confirmation of the name and the path of the generated unit file. Check that C:\Users\<your home directory>\My Documents\Appmethod\Projects\ClockLabel.pas is displayed. Carefully check that the shown path is correct!
    Confirm Unit File
  8. Now you have created your new package project. Select Yes to confirm that this package is for FireMonkey:

    ConfirmUnitClockLabel.png
  9. The following message confirms that your new component is built, installed, and registered in Appmethod:

    InformationPage.png
    Note: Remember the path of the created .BPL file.
  10. Create a new FireMonkey HD Application by right-clicking the project group in the Project Manager and selecting Add New Project from the context menu. Then select FireMonkey HD Application:

    AddNewProjectMenu.png
  11. Save your new FireMonkey HD Application as TestClockLabel.dproj and save the Unit as TestClockLabelUnit.pas. Save the project group as ClockLabelProjectGroup.groupproj by right-clicking the project group item in the Project Manager and selecting Save Project Group As from the context menu. Notice that the command first sequentially shows dialog boxes asking to save each project in the project group and in the end it shows the dialog box for saving the project group.
  12. Now you see the TClockLabel component on the Tool Palette when Form1 is shown in the Form Designer. However, when you drop TClockLabel onto the Form Designer, you may notice that TClockLabel just looks like TLabel. This is because you have not implemented any new features yet.
    LastOneHere.png
  13. Next, you implement the TClockLabel component.

Next