Recent

Author Topic: Highlighting the entire row width in TLazVirtualStringTree [SOLVED]  (Read 594 times)

carl_caulkett

  • Hero Member
  • *****
  • Posts: 650
* Mac Mini M1
* macOS 14.6.1
* Lazarus 3.4
* FPC 3.2.2

Is it possible to configure a TLazVirtualStringTree so that the highlighted row extends beyond Column 0 to all the columns in use?
If not set in the form designer, will I have to investigate owner-draw code to paint the background myself?
« Last Edit: September 29, 2024, 02:37:45 pm by carl_caulkett »
"It builds... ship it!"

carl_caulkett

  • Hero Member
  • *****
  • Posts: 650
Re: Highlighting the entire row width in TLazVirtualStringTree [SOLVED]
« Reply #1 on: September 29, 2024, 02:38:09 pm »
Code: Pascal  [Select][+][-]
  1. procedure TMain.PresetTreeBeforeCellPaint(Sender: TBaseVirtualTree;
  2.   TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex;
  3.   CellPaintMode: TVTCellPaintMode; CellRect: TRect; var ContentRect: TRect);
  4. begin
  5.   if PresetTree.Selected[Node] then
  6.   begin
  7.     TargetCanvas.Brush.Color := clHighlight;
  8.     TargetCanvas.FillRect(CellRect);
  9.   end;
  10. end;
  11.  
"It builds... ship it!"

wp

  • Hero Member
  • *****
  • Posts: 12754
Re: Highlighting the entire row width in TLazVirtualStringTree [SOLVED]
« Reply #2 on: September 29, 2024, 06:54:57 pm »
No need for custom painting. In the tree's TreeOptions.SelectOptions there's a toFullRowSelect.

carl_caulkett

  • Hero Member
  • *****
  • Posts: 650
Re: Highlighting the entire row width in TLazVirtualStringTree [SOLVED]
« Reply #3 on: September 30, 2024, 04:20:41 pm »
I searched high and low, but I didn't spot that! Thanks, I'll add it in now!
"It builds... ship it!"

 

TinyPortal © 2005-2018