Difference between revisions of "How To Write Lazarus Component"

From Lazarus wiki
Jump to navigationJump to search
Line 1: Line 1:
==Step 1: Creating Icons For The Package==
+
==Step 1: Create Icons For The Package==
  
  ~/lazarus/tools/lazres samplepackage.lrs mycom.png
+
* Size of PNG file should be 24x24
 +
* You may need to compile lazres at first use. Simply open the lazres.lpi in the IDE and at the menu click run > build.
 +
 
 +
To create the lrs file run (where samplepackage is the name of your package and TMyCom is the name of your component):
 +
 
 +
  ~/lazarus/tools/lazres samplepackage.lrs TMyCom.png
 +
 
 +
You can add more than one image to the lrs file by appending the image filename at the end. Eg. ~/lazarus/tools/lazres samplepackage.lrs TMyCom1.png TMyCom2.png ...
 +
 
 +
Following is a sample of the samplepackage.lrs file.
 +
 
 +
<pre>
 +
LazarusResources.Add('TMyCom','PNG',[
 +
  #137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#24#0#0#0#24#8#2#0#0#0'o'#21#170#175
 +
  +#0#0#0#4'gAMA'#0#0#177#143#11#252'a'#5#0#0#0'|IDAT8O'#237#212#209#10#192' '#8
 +
  +#5'P'#247#231#251's'#215#138#133#164#166'\'#220#195'`'#209'c'#157'L'#173#131
 +
  +#153#169'd4'#168'dP'#137'r_'#235'5'#136'@Zmk'#16'd9'#144#176#232#164'1'#247
 +
  +'I'#8#160'IL'#206'C'#179#144#12#199#140'.'#134#244#141'~'#168#247#209'S~;'#29
 +
  +'V+'#196#201'^'#10#15#150'?'#255#18#227#206'NZ>42'#181#159#226#144#15'@'#201
 +
  +#148#168'e'#224'7f<@4'#130'u_YD'#23#213#131#134'Q]'#158#188#135#0#0#0#0'IEND'
 +
  +#174'B`'#130
 +
]);
 +
 
 +
</pre>

Revision as of 18:38, 30 September 2008

Step 1: Create Icons For The Package

  • Size of PNG file should be 24x24
  • You may need to compile lazres at first use. Simply open the lazres.lpi in the IDE and at the menu click run > build.

To create the lrs file run (where samplepackage is the name of your package and TMyCom is the name of your component):

~/lazarus/tools/lazres samplepackage.lrs TMyCom.png

You can add more than one image to the lrs file by appending the image filename at the end. Eg. ~/lazarus/tools/lazres samplepackage.lrs TMyCom1.png TMyCom2.png ...

Following is a sample of the samplepackage.lrs file.

LazarusResources.Add('TMyCom','PNG',[
  #137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#24#0#0#0#24#8#2#0#0#0'o'#21#170#175
  +#0#0#0#4'gAMA'#0#0#177#143#11#252'a'#5#0#0#0'|IDAT8O'#237#212#209#10#192' '#8
  +#5'P'#247#231#251's'#215#138#133#164#166'\'#220#195'`'#209'c'#157'L'#173#131
  +#153#169'd4'#168'dP'#137'r_'#235'5'#136'@Zmk'#16'd9'#144#176#232#164'1'#247
  +'I'#8#160'IL'#206'C'#179#144#12#199#140'.'#134#244#141'~'#168#247#209'S~;'#29
  +'V+'#196#201'^'#10#15#150'?'#255#18#227#206'NZ>42'#181#159#226#144#15'@'#201
  +#148#168'e'#224'7f<@4'#130'u_YD'#23#213#131#134'Q]'#158#188#135#0#0#0#0'IEND'
  +#174'B`'#130
]);