blikblum/VirtualTreeView-Lazarus

Bug? Column header separators drawn incorrectly (no right border on last item)

Opened this issue · 3 comments

On Delphi Virtual Treeview headers are drawn like this

header|header|header|
i.e. border is placed at right and you can resize all columns including rightmost by dragging separator.

On Mac/LCLCocoa/inspecting PaintHeader/seeing results it is instead drawn
|header|header|header

The reason I consider that a bug is how resizing columns work in virtual treeview. With the current Lazarus solution you can not resize the rightmost column by dragging a visible separator.

In windows, i can resize the last column.

For an example, in demos folder open vtbasic project and click in database link. Please test and let me know what happens in this

After a ton of hours trial and error on macOS (I have not tested lazarus virtual tree view on Windows yet) I have a fix for -PaintColumnHeader- inserted after RightBorderFlag is set.

    // appears *Right* is otherwise one pixel too far right and thus overdrawn by either next-column-left-border OR whatever comes after last column (right-borders are used when resizing columns)
    Dec(PaintRectangle.Right);

    // remove all left borders which are otherwise shown.... or use condition *(AColumn = 0)* to only affect leftmost header left-border
    // remove all top borders which are otherwise shown (doing this as well mimics Delphi-Windows-VirtualTreeView look)
    // remove bottom borders (just for good measure)
    NormalButtonFlags := NormalButtonFlags and (not(BF_LEFT or BF_TOP or BF_BOTTOM));

For what it is worth - that works and look perfect. Now all the column headers are drawn like this:

header-border-header-border (i.e. at the most right is the right border of the most right column header)

Now all the column headers are drawn like this:
header-border-header-border (i.e. at the most right is the right border of the most right column header)

Its already being draw this way in windows (and as far as i remember in gtk2), so should be an different config or bug in interface.

Please test the example provided in demos folder (vtbasic)