How to add icons my package components

From Free Pascal wiki
Revision as of 13:17, 25 July 2015 by Alextp2 (talk | contribs) (Created page with "We have package "my_pkg" with components TComp1, TComp2 and want to add icons for components to IDE component pallette. First we have to prepare icons in .png files, size 24x...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

We have package "my_pkg" with components TComp1, TComp2 and want to add icons for components to IDE component pallette.

First we have to prepare icons in .png files, size 24x24. If you want get them from Delphi package, you can use the free "XN Resource Editor" to export icons from .dcr files.

Now we need app "lazres". It's located in "tools" subfolder of IDE folder. Compile it under Windows: "c:\lazarus\tools\lazres.lpi" to lazres.exe. We use lazres.exe to create Lazarus resource file .lrs from .png files:

   c:\lazarus\tools\lazres.exe my_pkg_icons.lrs TComp1.png TComp2.png

Into package my_pkg we add file my_pkg_icons.lrs (tab "Add file", type LRS).

At least one unit in package must have "initialization" in which we must write

   {$I my_pkg_icons.lrs}

After installing package, component pallette must have icons for TComp1, TComp2.