How to hide the minimize / collapse button in Virtual Treeview?

I am using VirtualStringTree (VST) to display data that is grouped, header data. I need to be able to allow the user to expand, collapse the headers to see the details, and in some cases I need to show the data as static views, where they cannot expand, collapse, see only the full extended tree:

Here is an example where a user can expand, collapse a node with a child node:

enter image description here

And here is an example when I want to prevent the user from expanding / minimizing the node and always see all the extended ones (or something like this):

enter image description here

in this test, I control the checkbox "Allow expand / collapse /".

I prevent expansion, folding by adding:

Allowed:=CheckBox1.Checked; 

in 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 the TreeLines base when checked 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 small plus sign when I want to prevent user expansion, collapse node. Any suggestions?


EDIT:

To eliminate confusion with the form symbol, this is a demo project from the Virtual Treeivew 5 demo library. The form in the IDE has a Delphi XE7 icon, this old icon appears when the project starts. I do not know why. I just wanted to make sure that I understand that I am using XE7 and not older versions of Delphi, where the same solution may not apply.

In the IDE icon, if as an XE7 icon:

enter image description here

+5
source share
1 answer

An additional parameter you are looking for is toShowButtons . Use it in the same place where you use toShowTreeLines .

The option is registered in VirtualTrees.pas in the declaration for TVTPaintOption :

  toShowButtons, // Display collapse/expand buttons left to a node. 
+6
source

Source: https://habr.com/ru/post/1244835/


All Articles