Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2011-09

What for Adding lrs file to Package?

7 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Mattias Gaertner
to Zaher Dirkey
Show quoted text 8 lines
Hi, What for when i add lrs file to the component package? because it is not take my controls icon inside it when built Lazarus with package. Is it possible in the future to add it in the source of package (feature request)?

I'm not sure what you mean.
You can add lrs to packages and you can include them in package units.

Mattias

Reply by email

Zaher Dirkey
to Mattias Gaertner

On Mon, Sep 12, 2011 at 6:05 PM, Mattias Gaertner <

Show quoted text 18 lines
wrote: On Mon, 12 Sep 2011 16:39:52 +0200 Zaher Dirkey wrote: > Hi, > > What for when i add lrs file to the component package? > because it is not take my controls icon inside it when built Lazarus with > package. > > Is it possible in the future to add it in the source of package (feature > request)? I'm not sure what you mean. You can add lrs to packages and you can include them in package units.

I converted my component icons to lrs file, then i added this file (lrs) to the Dialog package not the the source of it or source of file that register the controls, after build the lazarus with packages, my components icons not showed as i expected.
After i added lrs file to the unit that register my controls, the icons showed.
For that my as "What for when i add lrs file to the component package?" you can return to the original post.

(sorry for my poor English)

Thanks

Zaher Dirkey
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20110912/133b9dd0/attachment.html>

Reply by email

Mattias Gaertner
to Hans-Peter Diettrich: IMO it's a matter of {$R some.res}, what makes icons (and other resources) usable in…
Show quoted text 8 lines
Zaher Dirkey schrieb: > After i added lrs file to the unit that register my controls, the icons > showed. IMO it's a matter of {$R some.res}, what makes icons (and other resources) usable in code. AFAIK the standard {$R *.res} only includes the <programname>.lrs file,

No. lrs files are simple include files. They are included as string constants.

that's why it worked when you put your icons into that file. But it should be possible to add further {$R ...} directives, to include other resource files as well.

The $R directive supports icons in ico format. AFAIK it does not support png.

Mattias

Reply by email

Hans-Peter Diettrich
to Zaher Dirkey: On Mon, Sep 12, 2011 at 6:05 PM, Mattias Gaertner < I converted my component icons to lrs…
After i added lrs file to the unit that register my controls, the icons showed.

IMO it's a matter of {$R some.res}, what makes icons (and other resources) usable in code. AFAIK the standard {$R *.res} only includes the <programname>.lrs file, that's why it worked when you put your icons into that file. But it should be possible to add further {$R ...} directives, to include other resource files as well.

DoDi

Reply by email

Zaher Dirkey
to Mattias Gaertner: On Tue, 13 Sep 2011 00:08:37 +0200 No. lrs files are simple include files. They are…

On Tue, Sep 13, 2011 at 1:04 AM, Mattias Gaertner <

Show quoted text 18 lines
wrote: On Tue, 13 Sep 2011 00:08:37 +0200 Hans-Peter Diettrich wrote: > Zaher Dirkey schrieb: > > > After i added lrs file to the unit that register my controls, the icons > > showed. > > IMO it's a matter of {$R some.res}, what makes icons (and other > resources) usable in code. AFAIK the standard {$R *.res} only includes > the <programname>.lrs file, No. lrs files are simple include files. They are included as string constants.

In onther words, If adding lrs file to the package, it automatically add it to the package source like this

initialization
  {$i myctrls.lrs}

I like also if i add myfile.inc file it also add it to the source, so i can add my register function instead of create new unit for it.

procedure Register;
begin
  RegisterComponents(...);
  RegisterComponentEditor(...);
end;

Hmm, it is not good idea, how can i add units to uses in package source!?

Show quoted text 7 lines
> that's why it worked when you put your icons > into that file. But it should be possible to add further {$R ...} > directives, to include other resource files as well. The $R directive supports icons in ico format. AFAIK it does not support png.

It is a feature i like to have it in FPC.

Best Regards

Zaher Dirkey
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20110913/d526c430/attachment.html>

Reply by email

Mattias Gaertner
to Zaher Dirkey
Show quoted text 24 lines
On Tue, Sep 13, 2011 at 1:04 AM, Mattias Gaertner < > wrote: > On Tue, 13 Sep 2011 00:08:37 +0200 > Hans-Peter Diettrich wrote: > > > Zaher Dirkey schrieb: > > > > > After i added lrs file to the unit that register my controls, the icons > > > showed. > > > > IMO it's a matter of {$R some.res}, what makes icons (and other > > resources) usable in code. AFAIK the standard {$R *.res} only includes > > the <programname>.lrs file, > > No. lrs files are simple include files. They are included as > string constants. > > In onther words, If adding lrs file to the package, it automatically add it to the package source like this initialization {$i myctrls.lrs}

If you add a lrs to a package, you are responsible to add the above two lines somewhere.

Show quoted text 10 lines
I like also if i add myfile.inc file it also add it to the source, so i can add my register function instead of create new unit for it. procedure Register; begin RegisterComponents(...); RegisterComponentEditor(...); end; Hmm, it is not good idea, how can i add units to uses in package source!?

Use the package editor and add the unit. The default is to "use the unit", which means it is added to the uses section of the package source (main unit).

Mattias

Reply by email