Recent

Author Topic: TListView with Tree structure  (Read 2066 times)

OLLI_S

  • Full Member
  • ***
  • Posts: 119
TListView with Tree structure
« on: March 10, 2019, 12:40:23 am »
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

  • Hero Member
  • *****
  • Posts: 4219
Re: TListView with Tree structure
« Reply #1 on: March 10, 2019, 12:52:46 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?

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?

I don't really know but, maybe with one of the OnCustomDrawXXX or OnAdvancedCustomDrawXXX events?
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

wp

  • Hero Member
  • *****
  • Posts: 11923
Re: TListView with Tree structure
« Reply #2 on: March 10, 2019, 01:09:14 am »
Is that possible with TListView?

Is there a way to display the column headers in bold font?
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.
« Last Edit: March 10, 2019, 01:12:02 am by wp »

BeniBela

  • Hero Member
  • *****
  • Posts: 907
    • homepage
Re: TListView with Tree structure
« Reply #3 on: March 10, 2019, 10:25:00 am »
I call that TTreeListView

 

TinyPortal © 2005-2018