[Lazarus] VirtualTreeView: Expand/Collapse without OnNodeClick
Jürgen Hestermann
juergen.hestermann at gmx.de
Tue Sep 6 17:06:22 CEST 2016
Am 2016-09-06 um 16:33 schrieb Balázs Székely:
> This should work:
> procedure TfMain.VSTCollapsing(Sender: TBaseVirtualTree; Node: PVirtualNode;
> var Allowed: Boolean);
> begin
> CollapsingOrExapnding := True;
> end;
> procedure TfMain.VSTExpanding(Sender: TBaseVirtualTree; Node: PVirtualNode;
> var Allowed: Boolean);
> begin
> CollapsingOrExapnding := True;
> end;
> procedure TfMain.OnNodeClick(Sender: TObject);
> begin
> if not CollapsingOrExapnding then
> begin
> //regular node click(not +/- buttons), do something...
> ShowMessage('ok')
> end
> else
> CollapsingOrExapnding := False;
> end;
Thanks, yes, this workaround works okay.
Still I am wondering why such a workaround is needed at all.
The NodeClick-event should not be fired when nodes are just expanded/collapsed.
I have another VirtualTreeView instance where clicking on a node
just selects this node (which VTV does internally).
Interestingly, in this case I can collapse/expand without VTV selecting the node.
Only if I use the NodeClick-event it is fired together with expand/collapse.
IMO this is a bug.
More information about the Lazarus
mailing list