I use VirtualStringTree (VST) to display data that is grouped, header-details. I need to have an option to allow user to expand, collapse headers to see details and in some cases I need to show data as static view, where they can't expand, collapse, only see full expanded tree:
Here is example when user can expand, collapse node with child node:
And here is example when I want to prevent user to expand/collapse node and always see all expanded (or whatever is shown):
in this test I control by 'Allow Expand/Collapse/ checkbox.
I prevent expand, collapse by adding:
Allowed:=CheckBox1.Checked;
into OnCollapsing/OnExpanding:
procedure TMainForm.VSTCollapsing(Sender: TBaseVirtualTree;
Node: PVirtualNode; var Allowed: Boolean);
begin
Allowed:=CheckBox1.Checked;
end;
procedure TMainForm.VSTExpanding(Sender: TBaseVirtualTree;
Node: PVirtualNode; var Allowed: Boolean);
begin
Allowed:=CheckBox1.Checked;
end;
I also show/hide TreeLines base on checkbox with
procedure TMainForm.CheckBox1Click(Sender: TObject);
begin
if CheckBox1.Checked then
VST.TreeOptions.PaintOptions:=VST.TreeOptions.PaintOptions + [toShowTreeLines]
else
VST.TreeOptions.PaintOptions:=VST.TreeOptions.PaintOptions - [toShowTreeLines];
end;
How can I hide this little plus sign when I want to prevent user to expand, collapse node. Any suggestions?
EDIT:
To clear up the confusion with form icon, this is demo project from Virtual Treeivew 5 demo library. The form in IDE has Delphi XE7 icon, when running the project this old icon appear. Don't know why. Just wanted to make sure it is clear that I use XE7 and not any older Delphi versions, where the same solution might not apply.
In IDE the icon if as XE7 icon:
.res
file holding onto it. – Misericord