To help you better we need some information from you.
*** Please fill in the fields below. If you leave fields empty or specify 'latest' rather than the actual version your answer will be delayed as we will be forced to ask you for this information. ***
Product, version and build: Sapien PowerShell Studio, 2021
Operating system: Windows
PowerShell version(s):
32-bit version of software? yes
*** Please add details and screenshots as needed below. ***
Hi I have a code which shows a list in expanded view using Treeview.ExpandAll(). Using this, the focus goes to the bottom of the list. Is there a way I can show it to top of the list without selecting any nodes?
DO NOT POST LICENSES, KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM
$Treeview focus
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.
$Treeview focus
Again, start with the docs. You can clear a set object by assigning the object reference to "$null"
Go to full postRe: $Treeview focus
- # Move focus to the first root node.
- $treeList1.FocusedNode = $treeList1.Nodes[0]
Re: $Treeview focus
Hi,
I get the below error:
The property 'FocusedNode' cannot be found on this object. Verify that the property exists and can be set. I have used the code after $treelist1.expandall()
I get the below error:
The property 'FocusedNode' cannot be found on this object. Verify that the property exists and can be set. I have used the code after $treelist1.expandall()
Re: $Treeview focus
Tried the below code and it works:
$treeview1.SelectedNode = $treeview1.Nodes[0]
But it pre selects the list value as the top of the tree. This is a mandatory field on my form and pre selecting the value defeats the purpose of making user enter this value. Is there a way I can keep the focus on top of the tree without selecting a value from the list?
$treeview1.SelectedNode = $treeview1.Nodes[0]
But it pre selects the list value as the top of the tree. This is a mandatory field on my form and pre selecting the value defeats the purpose of making user enter this value. Is there a way I can keep the focus on top of the tree without selecting a value from the list?
Re: $Treeview focus
Thanks Heaps!
This works perfect and fulfills what we require.
For anyone else interested in the code:
$treeList.ExpandAll()
$treeList.SelectedNode = $treeList.Nodes[0]
$treeList.SelectedNode = $null
This works perfect and fulfills what we require.
For anyone else interested in the code:
$treeList.ExpandAll()
$treeList.SelectedNode = $treeList.Nodes[0]
$treeList.SelectedNode = $null