Re: [Lazarus] Using packages for often used units across projects?

2023-02-12 Thread Bo Berglund via lazarus
On Sun, 12 Feb 2023 15:35:27 +0100, Luca Olivetti via lazarus
 wrote:

>El 12/2/23 a les 14:44, Bo Berglund via lazarus ha escrit:
>
>> I found the wiki page:
>> https://wiki.lazarus.freepascal.org/Lazarus_Packages
>> 
>> it seems not to describe my use case, I believe.
>
>Actually it does, if you follow the heading "5.4 Creating a package for 
>your common units" right at the beginning of the page
>
>https://wiki.lazarus.freepascal.org/Lazarus_Packages#Creating_a_package_for_your_common_units
>
>
>Bye

Thanks Luca!
This is what I was looking for.
:)


-- 
Bo Berglund
Developer in Sweden

-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Using packages for often used units across projects?

2023-02-12 Thread Luca Olivetti via lazarus

El 12/2/23 a les 14:44, Bo Berglund via lazarus ha escrit:


I found the wiki page:
https://wiki.lazarus.freepascal.org/Lazarus_Packages

it seems not to describe my use case, I believe.


Actually it does, if you follow the heading "5.4 Creating a package for 
your common units" right at the beginning of the page


https://wiki.lazarus.freepascal.org/Lazarus_Packages#Creating_a_package_for_your_common_units


Bye

--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007

--
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Using packages for often used units across projects?

2023-02-12 Thread Kostas Michalopoulos via lazarus

On 2/12/23 15:44, Bo Berglund via lazarus wrote:

It seems not so good to copy the files into each project. In Delphi they were
accessed from one location by several projects by using search path settings
(not available in Lazarus).


You can set per-project unit search paths. This is available from 
Project -> Project Options -> Compiler Options (in the tree at the left 
side) -> Paths (below Compiler Options -> the "Other unit files" entry 
(you can use the ... button to edit the paths individually).



So now I wonder if one can put several really non-related units in a common
package such that they will be available in every application from Lazarus?
I.e. package lazcommon containing 5+ different units defining various classes
and compiled by the package handler.


Yes you can also use packages for this. Simply make a new package, click 
the "Add" button, click "Add Files from File System" and select the 
files you want to add to the package. Save, compile and the package is done.


To use the package from a project, either a) open the package itself and 
click "Use" and then "Add to project" or b) open the project's inspector 
from Project -> Project Inspector, click "Add", click "New requirement" 
and find the package name in the dialog box.


You don't need to have any components or GUI in the package (though if 
you want it is possible to have components, GUI and forms in them).


Kostas
--
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] Using packages for often used units across projects?

2023-02-12 Thread Bo Berglund via lazarus
I am working on porting a set of applications (company internal tools and
utilities mostly) from Delphi to FPC/Lazarus and now I have encountered use of a
number of same units in several different applications.

It seems not so good to copy the files into each project. In Delphi they were
accessed from one location by several projects by using search path settings
(not available in Lazarus).

So now I wonder if one can put several really non-related units in a common
package such that they will be available in every application from Lazarus?
I.e. package lazcommon containing 5+ different units defining various classes
and compiled by the package handler.

So I am not talking about a package implementing a common typoe of actions like
Internet communications or some graphics hanling or such, just a container that
would simplify using commonly used units like for serial comm, application
logging, special graphics etc

These files would not have a GUI impact at all, never placed on a form and not
configured in the GUI...
So this package would not be installed, just compiled in the package manager.

If this is how it can be done, is there some tutorial (for dummies) that handles
the way it is done?

I found the wiki page:
https://wiki.lazarus.freepascal.org/Lazarus_Packages

it seems not to describe my use case, I believe.
But it is too dense for me to really understand it all...

-- 
Bo Berglund
Developer in Sweden

-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] How to make TBitButton set the ModalResult properly and close the form?

2023-02-12 Thread Bo Berglund via lazarus
On Sat, 11 Feb 2023 21:15:25 +0100, Bo Berglund via lazarus
 wrote:

>So in order to fix this on the first form I have had to implement the OnClick
>event and code the following into them:
>
>ModalResult := mrOk
>(or mrCancel) as needed.
>
>This causes the wanted behaviour.
>
>But this was not how the Delphi TBitButton operated, why has it changed?
>And is there some way I can restore this functionality without having to add
>OnClick event handlers to all of these buttons?
>Some special $MODE setting perhaps?
>
>The Delphi converter I used in Lazarus to port the application put
>{$MODE Delphi}
>into most units..

It might be the converter that does this...
It made a new lfm file from the dfm that Delphi had made and maybe it did not
transfer the button kind properly so that the modalresult was not set as it
would be when the kind was selected...

Anyway by going over the forms and changing ModalResult to the proper value
depending on the Kind property value made it work as expected. No OnClick event
handler needed.

Now working properly.

-- 
Bo Berglund
Developer in Sweden

-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] How to make TBitButton set the ModalResult properly and close the form?

2023-02-12 Thread Salvatore Coppola via lazarus
Did you call the form with Form2.ShowModal?




Ottieni BlueMail per Android



Il giorno 11 Feb 2023, 23:26, alle ore 23:26, Bart via lazarus 
 ha scritto:
>On Sat, Feb 11, 2023 at 9:26 PM gabor via lazarus
> wrote:
>
>> Have you set the TBitButton.ModalResult property or TBitButton.Kind
>> property appropriately?
>
>This would normally also set ModalResult to mrOk (Kind := bkOK) or
>mrCancle (Kind := bkCancel).
>Setting the modalresult to those values should be enough (no OnClick
>needed) to close the modal form.
>It definitively does so for me.
>
>--
>Bart
>--
>___
>lazarus mailing list
>lazarus@lists.lazarus-ide.org
>https://lists.lazarus-ide.org/listinfo/lazarus
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus