Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to tell if a node exists in a treeview
Message
 
À
30/11/2001 11:35:19
Alexandre Palma
Harms Software, Inc.
Alverca, Portugal
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Divers
Thread ID:
00588046
Message ID:
00588050
Vues:
14
Sorry, I should have been a little clearer in my previous message:

If the node doesn't exist This.Nodes[SelectedKey] gives an error. I need to determine if it exists before I call that.

>Hi Roi try the following:
>
>lonode = This.Nodes[SelectedKey]
>IF VARTYPE(lonode) = 'O'
>   This.SelectedItem = lonode
>ENDIF
>
>>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
Roi
'MCP' Visual FoxPro

In Rome, there was a poem.
About a dog, who found two bone.
He lick the one, he lick the other.
He went pyscho, he drop dead!
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform