Forum > LCL

TListView with Tree structure

(1/1)

OLLI_S:
Hello,

I am using Lazarus 2.0.0 in Windows 10 Professional x64.

On my form I have a TListView that has 2 columns with static text where the user can select some entries (so Checkboxes is True, ReadOnly is True and also RowSelect is True).
The ViewStyle is vsReport.

I want to group the items in a tree structure.
So I want to add a static headline text and below of the text 2 entries as sub-entries (having 2 columns).
Then there should be a second static headline and below there should be 7 sub-entries.
The sub-entries should be collapsed and expanded (Tree View).

Is that possible with TListView?

Is there a way to display the column headers in bold font?

Best regards

OLLI

lucamar:

--- Quote from: OLLI_S on March 10, 2019, 12:40:23 am ---So I want to add a static headline text and below of the text 2 entries as sub-entries (having 2 columns).
Then there should be a second static headline and below there should be 7 sub-entries.
The sub-entries should be collapsed and expanded (Tree View).

Is that possible with TListView?

--- End quote ---

I seriously doubt it but ... I tried, I really tried, but I find myself unable to imagine what it is you want it to look like. So, do you have some example pic from other application or something?


--- Quote from: OLLI_S ---Is there a way to display the column headers in bold font?

--- End quote ---

I don't really know but, maybe with one of the OnCustomDrawXXX or OnAdvancedCustomDrawXXX events?

wp:

--- Quote from: OLLI_S on March 10, 2019, 12:40:23 am ---Is that possible with TListView?

Is there a way to display the column headers in bold font?

--- End quote ---
Not with TListView. But you should try VirtualTreeView which comes with Lazarus 2.0+ (folder components/VirtualtreeView). It is essentially an advanced treeview but supports multiple columns in addition to the main tree nodes. A lot a formatting options are available. Basic step-by-step instructions for almost exactly your problem can be found at http://wiki.freepascal.org/VirtualTreeview_Example_for_Lazarus.

BeniBela:
I call that TTreeListView

Navigation

[0] Message Index

Go to full version