Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Strange problem with Treeview SelectedItem property
Message
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Miscellaneous
Thread ID:
00812987
Message ID:
00815302
Views:
18
Hi Terry,

>>But when you access properties and methods of the .SelectedItem you are just accessing the node to which it refers and can manipulate it in exactly the same way as any Tree node.

>SelectedItem is a reference to a node. The properties we 'think" we are manipulating really belong to the node it references, and not 'SelectedItem'.

Aren't we both saying the same thing ?

>When we SelectedItem=.NULL. we are changing the data type of a node from object to .NULL. Refreshing the tree with a mouseclick or Acitivate, returns the node to the Object state.

.NULL. is a value not a datatype. After '.SelectedItem=NULL' .SelectedItem is still an object reference - it just doesn't point anywhere.

>This can be demonstrated in code
>cNodeKey=.SelectedItem.Key
>.SelectedItem=.NULL.
>?oNode(cNodeKey).Text && Data type error

Sorry, what is oNode ? There is no problem with :
.SelectedItem = .Nodes(1)
cnodekey = .SelectedItem.key
.SelectedItem = .NULL.
? .Nodes(cnodekey).Text
Also .SelectedItem can certainly have a .NULL. value when the tree is first populated. I don't know exactly when this gets assigned but it could be as late as Tree.GotFocus()

Regards,
Viv
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform