- $n = New-Object System.Windows.Forms.TreeNode
- $n.Name = $key
- $n.Text = $nodeName
- $n.ImageIndex = 0
- $n.SelectedImageIndex = 0
- $treeview.Nodes.Add($n)
Treeview - Node - Property (Plus/Minus)
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
- angelofstealth
- Posts: 69
- Last visit: Wed Sep 28, 2022 10:04 am
Treeview - Node - Property (Plus/Minus)
Is there a way to force or add a property to add the ShowPlusMinus to a treeview node? Example code below, works fine as far as loading in the objects in the treeview and clicking down through the treeview. Just none of my dropdowns will have Plus or Minus, the property is set by default to true and i have even code it on the treeview. No change. Treeview events are being loaded by NodeMouseClick to populate the treeview cascading, but without Plus Minus. I know I could detect for child items, just dont know how to force the property to have the plus/minus.
Re: Treeview - Node - Property (Plus/Minus)
The attached PSF will explain it all.
- Attachments
-
- Demo-TreeviewFolders.psf
- (31.52 KiB) Downloaded 160 times
- angelofstealth
- Posts: 69
- Last visit: Wed Sep 28, 2022 10:04 am
Re: Treeview - Node - Property (Plus/Minus)
Is there not a way to add the show plus/minus on adding the node vs on click? As with the psf attached my code is doing the same thing by showing the dropdown/plus after a click and not when the nodes are added.
- angelofstealth
- Posts: 69
- Last visit: Wed Sep 28, 2022 10:04 am
Re: Treeview - Node - Property (Plus/Minus)
I think i am going to adjust the way i load in the values with the node mouse click. Appreciate the help , should be good from here.
Re: Treeview - Node - Property (Plus/Minus)
The plus/minus is added automatically if the property is set to true. The demo just shows how to turn it on and off.
Carefully read all of the link I posted.
Carefully read all of the link I posted.
- angelofstealth
- Posts: 69
- Last visit: Wed Sep 28, 2022 10:04 am
Re: Treeview - Node - Property (Plus/Minus)
I agree it should be added automatically, i stated that in my first message.
In your attached psf, if I change the form property showplusminus from false (what is was) to true and run the code. It does not show a plus symbol on my end for C:\.
In your attached psf, if I change the form property showplusminus from false (what is was) to true and run the code. It does not show a plus symbol on my end for C:\.
Re: Treeview - Node - Property (Plus/Minus)
Initially there are no child nodes under the root. After you click it there are and the p/m will show. The +- only shows whn there ae child nodes.
Please read the link carefully. All of the rules are spelled out.
Please read the link carefully. All of the rules are spelled out.
- angelofstealth
- Posts: 69
- Last visit: Wed Sep 28, 2022 10:04 am
Re: Treeview - Node - Property (Plus/Minus)
For the childnodes loaded after the click, these childnodes that have childnodes don't show having plus/minus. Only after clicking the childnodes will the next childnodes show is the point i am trying to make. Instead of clicking the parent node, load childnodes and display childnodes that have childnodes below them. Which is why i was looking for a property to set as I have no issues creating the treeview/nodes under eachother with other properties.
I will take a look at the link, just stating the psf provided is doing the same thing my code is doing which is not displaying childnodes (plus/minus) under childnodes after root/parent is clicked.
I will take a look at the link, just stating the psf provided is doing the same thing my code is doing which is not displaying childnodes (plus/minus) under childnodes after root/parent is clicked.
Re: Treeview - Node - Property (Plus/Minus)
Because the nodes are only loaded if you have clicked them. That is the behavior of an incremental load. The code was written to demonstrate an incremental load and not to demo the +-. Click on all nodes until all are loaded then use the +- and all loaded nodes with loaded children will behave as you want.