Re: [Lazarus] Creating a library

2022-11-16 Thread Aruna Hewapathirane via lazarus
On Tue, Nov 15, 2022 at 3:50 PM Sven Barth via lazarus <
lazarus@lists.lazarus-ide.org> wrote:

> Am 15.11.2022 um 20:31 schrieb Aruna Hewapathirane:
>
>
> On Tue, Nov 15, 2022 at 2:28 PM Sven Barth via lazarus <
> lazarus@lists.lazarus-ide.org> wrote:
>
>> Am 15.11.2022 um 20:11 schrieb Aruna Hewapathirane via lazarus:
>> > Hello Everyone,
>> >
>> > I was wondering if it is possible for me to create a library with my
>> > own set of code snippets I use on a regular basis . Is there any
>> > example code I can possibly look at how this is done?
>> >
>> > Or a small single function example if someone is willing would help
>> > immensely.
>>
>> Do you really mean a library in the sense of a DLL or SO which requires
>> you to pay a bit more attention to how you code it due to the crossing
>> of the module boundaries or do you mean a Lazarus package which is a
>> collection of units that Lazarus will compile for you if necessary and
>> that you can use freely?
>>
>> Regards,
>> Sven
>>
>
>
> Hi Sven, my apologies I should have been more specific and yes it is the
> linux SO
> I am specifically interested in but certainly also interested in how to
> create the DLL
> for Windows.Thanks!
>
> Then please take a look here:
> https://www.freepascal.org/docs-html/prog/progch12.html#x262-27800012
>

Thank you, this is what I was looking for. Very much appreciate you taking
the time to help a noob. That is
some serious documentation by the way.. :-)

>
>
> But also pay attention to these articles on the Wiki which raise a few
> issues you need to be aware of:
> - https://wiki.freepascal.org/Lazarus/FPC_Libraries
> - https://wiki.freepascal.org/shared_library
>

Understood and shall comply. Thank you again!

>
>
> Important points of these to keep in mind:
> - don't allocate memory in the module and release in the program (or vice
> versa) - unless you use a common memory manager between them like ShareMem
> or cmem - this also includes strings and arrays
> - don't pass classes between module and program
> - don't propagate exceptions from the module to the program (or vice versa)
>
> Regards,
> Sven
>

Once again thank you very much for your time Sven.

Aruna




> --
> ___
> 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


[Lazarus] How to populate a TListView programatically

2022-11-16 Thread Aruna Hewapathirane via lazarus
Hello Everyone,

I tried going through the fpc documentation and did some searching on
Google and found this video on youtube:
https://www.youtube.com/watch?v=ohfG7KISNq0

The video did help me to understand what to do in the Lazarus IDE but I am
unable to find any code that shows me how to populate a TListView
programmatically/dynamically?

Does anyone have any example code that populates a Listview component
through code please?

Thank you,

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


Re: [Lazarus] How to populate a TListView programatically

2022-11-16 Thread Matthieu Giroux via lazarus
I have created a TDBLIstView which populates a TListView with data.But you car 
test it.

Matthieu Giroux 13 Rue Fr Tanguy PRIGENT A.15 - 35000 RennesTél : 02 23 46 06 
54 - 06 44 733 008
http://www.liberlog.fr 

Le jeudi 17 novembre 2022 à 00:03:29 UTC+1, Aruna Hewapathirane via lazarus 
 a écrit :  
 
 Hello Everyone,
I tried going through the fpc documentation and did some searching on Google 
and found this video on youtube: https://www.youtube.com/watch?v=ohfG7KISNq0
The video did help me to understand what to do in the Lazarus IDE but I am 
unable to find any code that shows me how to populate a TListView 
programmatically/dynamically? 

Does anyone have any example code that populates a Listview component through 
code please? 

Thank you,
Aruna
-- 
___
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


Re: [Lazarus] How to populate a TListView programatically

2022-11-16 Thread Werner Pamler via lazarus

Am 17.11.2022 um 00:03 schrieb Aruna Hewapathirane via lazarus:
Does anyone have any example code that populates a Listview component 
through code please?

procedure TForm1.FormCreate(Sender: TObject);
var
  item: TListItem;
  i: Integer;
begin
  for i := 0 to 9 do
  begin
    item := ListView1.Items.Add;
    item.Caption := 'Item ' + IntToStr(i);
    item.SubItems.Add('Subitem ' + IntToStr(i) + '/1');
    item.SubItems.Add('Subitem ' + IntToStr(i) + '/2');
    item.ImageIndex := i;
    item.SubItemImages[0] := i+1;
    item.SubItemImages[1] := i+2;
  end;
end;
--
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] How to populate a TListView programatically

2022-11-16 Thread Aruna Hewapathirane via lazarus
On Wed, Nov 16, 2022 at 6:20 PM Matthieu Giroux 
wrote:

> I have created a TDBLIstView which populates a TListView with data.
> But you car test it.
>

Do you have a link to the code please?


>
> Matthieu Giroux 13 Rue Fr Tanguy PRIGENT A.15 - 35000 Rennes
> Tél : 02 23 46 06 54 - 06 44 733 008
> http://www.liberlog.fr
>
>
> Le jeudi 17 novembre 2022 à 00:03:29 UTC+1, Aruna Hewapathirane via
> lazarus  a écrit :
>
>
> Hello Everyone,
>
> I tried going through the fpc documentation and did some searching on
> Google and found this video on youtube:
> https://www.youtube.com/watch?v=ohfG7KISNq0
>
> The video did help me to understand what to do in the Lazarus IDE but I am
> unable to find any code that shows me how to populate a TListView
> programmatically/dynamically?
>
> Does anyone have any example code that populates a Listview component
> through code please?
>
> Thank you,
>
> Aruna
> --
> ___
> 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


Re: [Lazarus] How to populate a TListView programatically

2022-11-16 Thread Aruna Hewapathirane via lazarus
On Wed, Nov 16, 2022 at 6:29 PM Werner Pamler via lazarus <
lazarus@lists.lazarus-ide.org> wrote:

> Am 17.11.2022 um 00:03 schrieb Aruna Hewapathirane via lazarus:
> > Does anyone have any example code that populates a Listview component
> > through code please?
> procedure TForm1.FormCreate(Sender: TObject);
> var
>item: TListItem;
>i: Integer;
> begin
>for i := 0 to 9 do
>begin
>  item := ListView1.Items.Add;
>  item.Caption := 'Item ' + IntToStr(i);
>  item.SubItems.Add('Subitem ' + IntToStr(i) + '/1');
>  item.SubItems.Add('Subitem ' + IntToStr(i) + '/2');
>  item.ImageIndex := i;
>  item.SubItemImages[0] := i+1;
>  item.SubItemImages[1] := i+2;
>end;
> end;
> --
>

This is exactly what I was looking for. It is the subitems that was giving
me a real problem.
Thank you very much Werner.



> ___
> 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