[Lazarus] TListView: Column Header Captions and Column Sorting

Aruna Hewapathirane aruna.hewapathirane at gmail.com
Thu Nov 17 15:42:16 CET 2022


On Thu, Nov 17, 2022 at 7:54 AM R.Smith via lazarus <
lazarus at lists.lazarus-ide.org> wrote:

>
> On 2022/11/17 13:47, Aruna Hewapathirane via lazarus wrote:
>
> On Thu, Nov 17, 2022 at 6:39 AM Michael Van Canneyt via lazarus <
> lazarus at lists.lazarus-ide.org> wrote:
>
>>
>>
>>
>> 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.
>
> Not necessarily - it's not forcibly commanded to be done like that, it's
> just an easier, faster (to program) and more homogenous way of doing. This
> next version of the same code will also work just fine, but it requires you
> to keep track of numbering, which is mental load you do not need, and also
> makes it hard to insert/delete code rows, since you have to adjust all the
> column numbers above and below the affected row:
>
> begin
>    Listview1.Columns.Add;
>    Listview1.Columns[0].Caption:='Country';
>    Listview1.Columns.Add;
>    Listview1.Columns[1].Caption:='Region';
> end;
> So out of programming paradigm interest, yes this can work, but Michael's
> example is by far the more sensible preferred way of doing it.
>

Thank you, I believe it is always good to know alternative ways to achieve
the same end result. And you are right I will stick with Michael's example
:-)

>
>
>>
> 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.
>
>
> That's appreciated
>
I meant what I said very sincerely and straight from the heart. If you have
ever tried hacking the Linux kernel you will understand what I mean. That
can be a very
frustrating experience for a total newcomer and I am yet to ask a question
in more than a decade now of dabbling with linux and receive a straight
answer with a
clear and concise example that I can study and learn from.

I do not say this in a bad way but they usually ask " What problem are you
trying to solve?" and am scratching my head thinking I am not trying to
solve anything
I am just trying to learn and understand why things are done in a certain
way? Never will they give you what you ask for but happily give you rather
cryptic hints
that lead you down a very dark rabbit hole.

The end result is most newcomers do not stick around long enough. Soo..
when I am suddenly exposed to a whole new level of immediate and sincere
support
that to me is an extremely welcome and empowering experience.  Sadly does
not happen a lot with Linux they can be a very toxic bunch. So this is very
much
appreciated and like I said totally unexpected and that is what humbled me.

Do not get me wrong the Linux community also has very sincere people I will
never forget how foolish I felt after sending out a noob question on the
kernel newbies
list and everyone was more or less giving me a hard time and just when I
was about to call it quits Dan Carpenter emails me saying " We were all
newbies at one point.."
that is when I decided you lot are not going to make me stop loving Linux
:-)

Only someone who writes code will truly understand the pain when you have
access to all possible documentation which is comprehensive
to say the least with lazarus and fpc but sadly lacking examples
demonstrating the components functionality which I will try to change
slowly once I have become sufficiently
comfortable with the IDE and FPC and learnt how things are done. Wish me
luck :-)

> - also note, in light of your next question, the TListView docs, available
> both in the online Wiki (https://wiki.freepascal.org/TListView - though
> it is quite lacking in useful examples currently),
>
Examples we can always build ? I am actually now thinking of doing exactly
that :-)

> the online Docs with short but clear function descriptions (see here:
> https://lazarus-ccr.sourceforge.io/docs/lcl/comctrls/tlistview.html and
> here: https://lazarus-ccr.sourceforge.io/docs/lcl/comctrls/tlistitems.html)
> and bundled in the install (though there is a slight trick to make it work
> on Windows since it dropped automatic support for help files (.hlp? .chm? -
> I forget the extension on windows))
>
I left Windows long years ago after they nuked my desktop multiple times (
Yes they actually did that ) and I got fed up of looking at blue screen of
death after each re-install and given it was a pirated copy
but I had no financial support back then I was between jobs laid off and
dead broke and they go and fry my machine. So uh-uh never again I switched
to Linux and immediately experienced the freedom
I started with Ubuntu ( karmic ) and now use bleeding edge Debian it has
never failed me so far. It does not get in my way and is robust, stable and
simply works. Being able to customise
anything I want is a very big plus :-)

> The Lazarus Forum is usually also a trove of examples (ex:
> https://forum.lazarus.freepascal.org/index.php?topic=11796.0) and a good
> place to ask questions.
>
Yes I have started exploring the Lazarus Forum and it is full of goodies.
Thank you.

I have a small request if I may? Recently I was on the Lazarus IRC channel
and it was a very long day for me and I had food on the stove and all I
wanted was to know where I can find the Gstremer examples and someone (
Norayr I think was his/her handle on irc ) immediately reached out and
helped me. Then Joanna signed in and we had a bit of back and forth and I
must have said or done something that must have upset or annoyed her so I
am now *banned* from the IRC which is sad and makes me unhappy. So with
permission from all here I would like to publicly apologize to Joanna ( I
belive she is the moderator for Lazarus IRC ) for whatever it is that I
said or did to make her unhappy and respectfully request I be re-instated
in the IRC channel. Yes I can use a vpn and get in, or turn off the wifi on
my cell and get in but I really do not wish to do this. So I really am very
sorry Joanna please re-consider your decision to ban me. ( Phew... )


> Welcome to FPC/Lazarus and good luck!
>
It feels like 'home' here if you know what I mean and thank you I will try
to contribute meaningfully once I am up to that standard with the ide and
fpc.

I am sorry about all the irrelevant stuff but maybe all this will give some
context that actually may help moving forward.

Very sincerely and respectfully a sometimes grumpy 62 year old who has over
the years grown a very thick skin :-)

Thank you all,

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/3c81c448/attachment-0001.htm>


More information about the lazarus mailing list