[Lazarus] Collapse/Expand "bug" in VirtualTreeView "fixed".

Jürgen Hestermann juergen.hestermann at gmx.de
Tue Aug 23 18:10:35 CEST 2016


Am 2016-08-23 um 17:11 schrieb Jürgen Hestermann:
 > I am wondering whether this is all as intended.
 > Why is the column changed in GetColumnAndBounds
 > depending on whether a cell is empty?
 > It makes no sense to me.

I think the code in GetHitTestInfoAt needs changes (is buggy).

For example, the searching to the right for an non-empty column
has no effect as it does not change HitInfo.HitColumn:

 > -----------------------------------------------------------
// Search to the right of the hit column for empty columns.
repeat
    InitialColumn := FHeader.FColumns.GetNextVisibleColumn(InitialColumn);
    if (InitialColumn = InvalidColumn) or not ColumnIsEmpty(HitInfo.HitNode, InitialColumn) then
       Break;
    Inc(ColRight,FHeader.FColumns[InitialColumn].Width);
until False;
 > -----------------------------------------------------------

It only changes InitialColumn but not HitInfo.HitColumn.

In the end, when *all* cells (columns) of a row are empty
(as ist the case as default if no event routine OnGetCellsEmpty
is defined by the programmer) then GetHitTestInfoAt should
report the original column and not change this default (correct) column value.
In this case the bug would be avoided even without the workaround
of defining an event routine OnGetCellsEmpty with IsEmpty := false.

Another option would be to set

Result := False;

in ColumnIsEmpty.
As this routine does not know about the state anyway setting it to true is not good.
Setting it to false would avoid the issue above too.








More information about the Lazarus mailing list