Recent

Author Topic: New versions of LCLCocoa - virtual treeview paints column headers black  (Read 1300 times)

MISV

  • Hero Member
  • *****
  • Posts: 728
Just updated to newest source and all column headers are now painted all black.

This happens with both
- https://github.com/blikblum/VirtualTreeView-Lazarus/
- And version shipped in Lazarus (just did complete SVN update yesterday)

For the rest of this post I will be using the version shipped with Lazarus (laz.virtualtreeview / LazVirtualTreeview)

I havde made no code changes and there is no owner-draw or similar in play here. Content/data draws correctly.

Here is a link to error report on BlikBlum Github page:
https://github.com/blikblum/VirtualTreeView-Lazarus/issues/24

However, since blikblum and lazarus versions are not always fully sync'ed, I guess I will be using laz.virtualtreeview / LazVirtualTreeview for when debugging the issue through this forum.

I would appreciate is anyone else could also chip in and see if they experience the same error.

-- I do not believe Mac update affects this since my old compiled versions still work correctkly --
« Last Edit: February 17, 2021, 11:43:38 am by MISV »

MISV

  • Hero Member
  • *****
  • Posts: 728
Re: New versions of LCLCocoa - virtual treeview paints column headers black
« Reply #1 on: February 17, 2021, 11:34:50 am »
Here is screenshot

GetMem

  • Hero Member
  • *****
  • Posts: 3451
Re: New versions of LCLCocoa - virtual treeview paints column headers black
« Reply #2 on: February 17, 2021, 01:57:31 pm »
I cannot help you with the bug, since I don't own a Mac. However until the issue is fixed, why don't you owner draw the header background? The text, sort glyph, etc...can remain the same, only change the background color.

MISV

  • Hero Member
  • *****
  • Posts: 728
Re: New versions of LCLCocoa - virtual treeview paints column headers black
« Reply #3 on: February 17, 2021, 04:53:27 pm »
If I can simply only override background color and that works then... Worth a try. I will report back tonight.

GetMem

  • Hero Member
  • *****
  • Posts: 3451
Re: New versions of LCLCocoa - virtual treeview paints column headers black
« Reply #4 on: February 17, 2021, 05:20:08 pm »
@MISV
Try this:
1. Set VST->Header->Options hoOwnerDraw to true
2. Create the following events: OnAdvancedHeaderDraw and OnHeaderDrawQueryElements
3.
Code: Pascal  [Select][+][-]
  1. uses LCLType;
  2.  
  3. procedure TForm1.VSTAdvancedHeaderDraw(Sender: TVTHeader;
  4.   var PaintInfo: THeaderPaintInfo; const Elements: THeaderPaintElements);
  5. begin
  6.   if PaintInfo.Column = nil then
  7.   begin    
  8.     PaintInfo.TargetCanvas.Brush.Color := clBtnFace; //change this
  9.     PaintInfo.TargetCanvas.FillRect(PaintInfo.PaintRectangle);
  10.     PaintInfo.TargetCanvas.FrameRect(PaintInfo.PaintRectangle);
  11.   end
  12.   else
  13.   begin
  14.     PaintInfo.TargetCanvas.Brush.Color := $00C4C4C4; //similar to clBtnFace, change this
  15.     PaintInfo.PaintRectangle.Left := PaintInfo.PaintRectangle.Left - 1;
  16.     PaintInfo.PaintRectangle.Top := PaintInfo.PaintRectangle.Top - 1;
  17.     PaintInfo.TargetCanvas.FrameRect(PaintInfo.PaintRectangle);
  18.   end;
  19. end;
  20.  
  21. procedure TForm1.VSTHeaderDrawQueryElements(Sender: TVTHeader;
  22.   var PaintInfo: THeaderPaintInfo; var Elements: THeaderPaintElements);
  23. begin
  24.   Elements := Elements  + [hpeBackground];
  25. end;                            

MISV

  • Hero Member
  • *****
  • Posts: 728
Re: New versions of LCLCocoa - virtual treeview paints column headers black
« Reply #5 on: February 18, 2021, 01:24:41 am »
This solution works.

Seems clAppWorkSpace for header/columns background and clActiveBorder for borders/frames/separaters are the way to go...
Or
clWindow / clWindowFrame (latter for separators instead of frames)

I am not entirely sure they color choices will work well with both dark/white mac themes or other Mac OS themning/customization but seem like the two best bets

Should I report the original problem here as well: https://bugs.freepascal.org/main_page.php ?

GetMem

  • Hero Member
  • *****
  • Posts: 3451
Re: New versions of LCLCocoa - virtual treeview paints column headers black
« Reply #6 on: February 18, 2021, 06:16:24 am »
Without the possibility of debug, it looks like the theme service fails to get the correct background for the header under cocoa.  Please mention this on the bugreport, maybe it helps with the fix.

MISV

  • Hero Member
  • *****
  • Posts: 728
Re: New versions of LCLCocoa - virtual treeview paints column headers black
« Reply #7 on: February 18, 2021, 10:00:59 am »
I have submitted this bug report
https://bugs.freepascal.org/view.php?id=38507


 

TinyPortal © 2005-2018