Recent

Author Topic: Bug? DrawEdge not implemented  (Read 383 times)

MISV

  • Hero Member
  • *****
  • Posts: 603
Bug? DrawEdge not implemented
« on: July 17, 2019, 01:45:26 pm »
I was researching this issue with the missing column splitters/borders/separators in virtual treeview:
https://forum.lazarus.freepascal.org/index.php/topic,45852.0.html

It uses and calls DrawEdge (with flag to paint border) which when stepping through code ends at

WinAPI.inc - DrawEdge - calls WidgetSet.DrawEdge
intfbasewinapi.inc - TWidgetSet.DrawEdge - enire code considt of "Result := False"

... So seems to be that is probably the reason...

It this intended behavior? I guess it could be if that is standard in macOS - on the other hand it is a bit confusing in big controls with a ton of data columns that here are no splitters/borders/separators/

...

just for good measure, I have also reported it to virtual treeview lazarus maintainer since I do not believe it is intended behavbior for VT:
https://github.com/blikblum/VirtualTreeView-Lazarus/issues/13
« Last Edit: July 21, 2019, 01:44:24 pm by MISV »

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2235
    • havefunsoft.com
Re: Bug? DrawEdge not implemented
« Reply #1 on: July 17, 2019, 03:24:38 pm »
It this intended behavior? I guess it could be if that is standard in macOS - on the other hand it is a bi confusing in bug controls with a ton of data columns that are no splitter/border/separator/
I'd say it's missed implementation. Yet I'd think there should be a basic implementation in TWidgetSet itself.
I don't really see, how drawing a rectangle edges (with Windows defined styles) could be any OS specific.
The system could supply colors (which is critical for dark theme for sure), but other than that, I can't think of anything else Cocoa could be useful for.
Patron Cocoa Widgetset development https://www.patreon.com/skalogryz

MISV

  • Hero Member
  • *****
  • Posts: 603
Re: Bug? DrawEdge not implemented
« Reply #2 on: July 17, 2019, 03:27:35 pm »
Would you say I should report this in another LCL forum group as well (i.e. minimal/basic implementation needed)

Or would you still consider it for a LCL-Cocoa todo-list?

Should I make an official bug report? (LCL-Cocoa?)


skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2235
    • havefunsoft.com
Re: Bug? DrawEdge not implemented
« Reply #3 on: July 17, 2019, 03:39:03 pm »
Would you say I should report this in another LCL forum group as well (i.e. minimal/basic implementation needed)

Or would you still consider it for a LCL-Cocoa todo-list?

Should I make an official bug report? (LCL-Cocoa?)
It's still to be considered as Cocoa bug (i.e. Win32 widgetset works)
So it would never hurt to bug-report the issue (at least it would not be forgotten)
The actual fix, might differ.
Yet, in the end the target is for the widgetset to work.
Patron Cocoa Widgetset development https://www.patreon.com/skalogryz

MISV

  • Hero Member
  • *****
  • Posts: 603
Re: Bug? DrawEdge not implemented
« Reply #4 on: July 17, 2019, 05:11:39 pm »

MISV

  • Hero Member
  • *****
  • Posts: 603
Re: Bug? DrawEdge not implemented
« Reply #5 on: July 19, 2019, 10:42:17 am »
Maybe we could make a simple implementation here / find one in other widgetsets. I will try look around

MISV

  • Hero Member
  • *****
  • Posts: 603
Re: Bug? DrawEdge not implemented
« Reply #6 on: August 10, 2019, 09:07:42 pm »
I see a fix has been added in LCLCocoa - but it does not solve the problem with virtual treeview. And I think I have identified a bug in the new LCLCocoa solution...

If we go to TCocoaWidgetSet.DrawEdge and see code snippets

Code: Pascal  [Select]
  1. const
  2.   InnLT= cl3DHiLight;
  3.   InnBRR = cl3dShadow;
  4.  
Code: Pascal  [Select]
  1. if (edge and BDR_INNER > 0)  then
  2. begin
  3.   if edge and BDR_RAISEDINNER > 0 then
  4.     DrawEdgeRect(ctx, r, grfFlags, InnLT, InnBR)
  5.  

The drawn borders are NOT visible... but if I e.g. set those values to clRed it works...

So I think the consts used to set the InnLT and InnBR value are not valid in Cocoa?
« Last Edit: August 10, 2019, 09:11:11 pm by MISV »

MISV

  • Hero Member
  • *****
  • Posts: 603
Re: Bug? DrawEdge not implemented
« Reply #7 on: August 12, 2019, 01:55:03 am »
IF anyone bothering with this it seems using clWindowFrame works/looks okay - at least on aqua


IF anyone else using virtual tree you can use the following "hot fix" in PaintColumnHeader to make the rest look good.

Code: Pascal  [Select]
  1.         // appears *Right* is otherwise one pixel too far right and thus overdrawn by either next-column-left-border OR whatecer comes after last column (right-borders are used when resizing columns)
  2.         Dec(PaintRectangle.Right);
  3.         // remove all left borders which are otherwise shown.... or use condition *(AColumn = 0)* to only affect leftmost header left-border
  4.         // remove all top borders which are otherwise shown (doing this as well mimics Delphi-Windows-VirtualTreeView look)
  5.         // remove bottom borders (just for good measure)
  6.         NormalButtonFlags := NormalButtonFlags and (not(BF_LEFT or BF_TOP or BF_BOTTOM));
  7.