[Lazarus] VirtualTreeView: Expand/Collapse without OnNodeClick
Jürgen Hestermann
juergen.hestermann at gmx.de
Wed Sep 7 00:55:35 CEST 2016
Am 2016-09-06 um 17:06 schrieb Jürgen Hestermann:
> 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.
>
Unfortunately, this workaround has another side effect
because the OnCollapsing/OnExpanding routines are not only
called when someone clicks on the buttons but also when
I do expand/collapse internally or when VTV does this.
Then the boolean variable stays true and the first click
on the node does not work.
So I have to again work around the workaround...
I am still wondering why this is needed at all...
More information about the Lazarus
mailing list