Recent

Author Topic: VirtualTreeView with footer  (Read 402 times)

bpranoto

  • Full Member
  • ***
  • Posts: 109
VirtualTreeView with footer
« on: May 23, 2022, 12:29:46 pm »
Does Virtual Treeview class have feature to display footer?

Thank you.

eldonfsr

  • Sr. Member
  • ****
  • Posts: 295
Re: VirtualTreeView with footer
« Reply #1 on: May 29, 2022, 10:52:39 pm »
As i Know it doesn't have footer ....

bpranoto

  • Full Member
  • ***
  • Posts: 109
Re: VirtualTreeView with footer
« Reply #2 on: May 30, 2022, 07:19:45 pm »
Well,

I manage to add a footer easily with THeaderControl component.

Here what I did:

1. Place the Treeview on a panel, set Align to alTop
2. Place a HeaderControl below the treeview in the same panel, set the align to alClient
3. Create sections on header control related to your treeview columns. So if you have 3 columns in the treeview, create 3 sections in the header control.
4. Set the each section of the header control the same width with its related treeview column.
5. In the run time, synchronize treeview columns width change to the header control via OnColumnResize event like this:

Code: Pascal  [Select][+][-]
  1. procedure TFormRABSpectra.VTDataColumnResize(Sender: TVTHeader;
  2.   Column: TColumnIndex);
  3. var
  4.   i : Integer;
  5. begin
  6.   for i := 0 to RAB_KOLOM_COUNT do begin
  7.     Self.Footer.Sections[i].Width:=Self.VTData.Header.Columns[i].Width;
  8.   end;
  9. end;
  10.  

Attached is a screenshot of  my treeview with footer.

 

TinyPortal © 2005-2018