[Lazarus] TListView: Column Header Captions and Column Sorting

Aruna Hewapathirane aruna.hewapathirane at gmail.com
Thu Nov 17 12:47:15 CET 2022


On Thu, Nov 17, 2022 at 6:39 AM Michael Van Canneyt via lazarus <
lazarus at lists.lazarus-ide.org> wrote:

>
>
> On Thu, 17 Nov 2022, Aruna Hewapathirane via lazarus wrote:
>
> > Hello Everyone,
> >
> > I managed to get the TListView to work after studying the example Sven
> > sent. You can see a screenshot here:
> https://pasteboard.co/inCtdrOWwAvV.png
> >
> > How do I set the caption/Title for each column header? How do I set
> column
> > header 1 to 'Country' and column header 2 to 'Region' please?
>
> Var
>    aCol : TListviewColumn;
>
> begin
>    aCol:=Listview1.Columns.Add;
>    aCol.Caption:='Country';
>    aCol:=Listview1.Columns.Add;
>    aCol.Caption:='Region';
> end;
>

Ah.. I am now beginning to understand. So you get the column into a
variable then use the variable to access and
set any properties?   Thank you so much for your time Michael.

>
>
> >
> > Is it possible to sort? By each column ? If so how?
>
> It is possible to sort:
>
>    Listview1.SortColumn:=0; // change to column you need
>    Listview1.SortDirection:=sdAscending;
>    Listview1.Sort;
>

Wow this is sweet!

>
> Michael
>

I just want to say this has to be the fastest support I have ever received
and always with a response that
is a concrete solution effectively diminishing the barriers for entry for
newcomers. I am extremely grateful and humbled.

Thank you!

 Aruna






> _______________________________________________
> lazarus mailing list
> lazarus at lists.lazarus-ide.org
> https://lists.lazarus-ide.org/listinfo/lazarus
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20221117/c2e426ba/attachment.htm>


More information about the lazarus mailing list