Sign in Join

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

Mailing lists / lazarus / 2013-08

Including and existing unit

4 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

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

Richard Mace

Hi All,
I am writing to similar applications, and want the "child" app to use some of the units of the parent app. If the units for the child app are in a different directory from the parent app, what's the best way of using an "include" in the child app?

Hope that makes sense?

Thanks

Richard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20130807/1097ce4f/attachment-0001.html>

Reply by email

Antonio Fortuny
to Richard Mace

Le 07/08/2013 07:29, Richard Mace a ?crit :

Show quoted text 7 lines
Hi All, I am writing to similar applications, and want the "child" app to use some of the units of the parent app. If the units for the child app are in a different directory from the parent app, what's the best way of using an "include" in the child app? Hope that makes sense?

Definitely yes. I'm used to create as much as needed source lib folders to store units common to more than one project. Folder's hierarchy depends on projects hierarchy. For example:
root
lib
group1
lib1
project1
project2
group2
lib2
project3
project4

projects 1 & 2 share untils in lib1. Same for projects 3 & 4 with lib2 But project 4 and project1 can share units within lib. When importing a unit in a project from a foilder ouside of the project's one, Lazarus proposes to insert the new source folder into the project's search path. So it's very easy.

Antonio.

Show quoted text 11 lines
Thanks Richard -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Andrew Brunner
to Richard Mace: I am writing to similar applications, and want the "child" app to use some of the units…

It's all about object inheritance. You would just create your objects in a unit file. Have all the methods organized as a TObject. Then you just create an instance and use it.

Forms have inheritance too. You can create an instance of a particular form. But the principal is the same.

To include the file to use it ... Add the unit file to the uses section of the unit.

Richard Mace wrote 18 lines
Hi All, I am writing to similar applications, and want the "child" app to use some of the units of the parent app. If the units for the child app are in a different directory from the parent app, what's the best way of using an "include" in the child app? Hope that makes sense? Thanks Richard -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Andrew Brunner Aurawin LLC 19309 Stage Line Trail Pflugerville, TX 78660 https://aurawin.com/ Aurawin is a great new way to store, share, and explore all your content featuring our innovative cloud social computing platform.

Reply by email

Antonio Fortuny
to Antonio Fortuny: Le 07/08/2013 07:29, Richard Mace a ?crit : Definitely yes. I'm used to create as much as…

Le 07/08/2013 13:38, Richard Mace a ?crit :

Thanks for the reply. In Lazarus, how do you include the unit?

Very simple: open the project option (Ctrl+F11), look in COmpiler Options then Paths. Fill in Other unit files as appropriate. Have a look into http://wiki.freepascal.org/IDE_Window:_Project_Options

Antonio.

Show quoted text 60 lines
On 7 Aug 2013 08:53, "Antonio Fortuny" < <mailto:>> wrote: Le 07/08/2013 07:29, Richard Mace a ?crit : Hi All, I am writing to similar applications, and want the "child" app to use some of the units of the parent app. If the units for the child app are in a different directory from the parent app, what's the best way of using an "include" in the child app? Hope that makes sense? Definitely yes. I'm used to create as much as needed source lib folders to store units common to more than one project. Folder's hierarchy depends on projects hierarchy. For example: root lib group1 lib1 project1 project2 group2 lib2 project3 project4 projects 1 & 2 share untils in lib1. Same for projects 3 & 4 with lib2 But project 4 and project1 can share units within lib. When importing a unit in a project from a foilder ouside of the project's one, Lazarus proposes to insert the new source folder into the project's search path. So it's very easy. Antonio. Thanks Richard -- _______________________________________________ Lazarus mailing list <mailto:> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- _______________________________________________ Lazarus mailing list <mailto:> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Sita Software *Antonio Fortuny* Senior Software engineer 220, avenue de la Libert? L-4602 Niederkorn Tel.: +352 58 00 93 - 93 www.sitasoftware.lu <http://www.sitasoftware.lu> Your IT Partner -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20130807/5350d1a5/attachment-0001.html> -------------- next part -------------- A non-text attachment was scrubbed... Name: fefiejff.jpg Type: image/jpeg Size: 2306 bytes Desc: not available URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20130807/5350d1a5/attachment-0002.jpg> -------------- next part -------------- A non-text attachment was scrubbed... Name: iffchdib.jpg Type: image/jpeg Size: 921 bytes Desc: not available URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20130807/5350d1a5/attachment-0003.jpg>

Reply by email