Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to tell if a node exists in a treeview
Message
From
30/11/2001 11:49:40
 
 
To
30/11/2001 11:47:53
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Miscellaneous
Thread ID:
00588046
Message ID:
00588065
Views:
19
>>I have a method that rebuilds all the nodes in a treeview.
>>
>>I save the currently selected node with:
>>
SelectedKey = This.SelectedItem.Key
>>
>>Then I clear all the nodes and rebuild the tree.
>>
>>Then I want to reselect the Selected item with:
>>
This.SelectedItem = This.Nodes[SelectedKey]
>>This.SelectedItem.ensurevisible
>>
>>However sometimes the SelectedKey doesn't exist once the tree is rebuilt. Is there an easy way to determine that? I can't spin through all the keys because I build each branch dynamically as it is expanded. The only thing I've can think of is setting it, catching the error if it doesn't exist, and going on from there.
>>
>>tia


CORRECTED

>Roi,
>
>Try
>
>IF TYPE('THIS.Nodes(SelectedKey)') = 'O'
>
> This.SelectedItem = This.Nodes[SelectedKey]
> This.SelectedItem.ensurevisible
>
>ENDIF
>
>Dan
Previous
Reply
Map
View

Click here to load this message in the networking platform