Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Strange problem with Treeview SelectedItem property
Message
 
To
28/07/2003 13:19:55
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Miscellaneous
Thread ID:
00812987
Message ID:
00814437
Views:
20
There is always a selecteditem, unless you set the selected node to .NULL. Consider SelectedItem a reference to point to a node's properties.
?oTv.SelectedItem.Selected
lcKey=oTv.SelectedItem.Key
oTv.SelectedItem=.NULL.
oTv.Nodes(lcKey).Selected=.t. && do you get a data type error here?
THISFORM.Tree.SelectedItem would be a VALID pointer to that first highlighted tree node.
Maybe not right away - if it was assigned a .NULL.


>MISTER TerryT,
>
>>>Hi Jim,
>>>
>>>
>>>THISFORM.Tree.SelectedItem = THISFORM.Tree.Nodes(1)
>>>
>>>
>>
>>Viv -
>>SelectedItem is a reference and probably always be an object:
>>We can:
>>SelectedItem.Selected=.f.
>>or
>>SelectedItem.Selected=.t. && Only way to uurn off highlight when TV has focus
>
>These bits are news to me (though I did see Viv mention setting to logical I think).
>Given that .SelectedItem refers to a Node I thought that setting it to .NULL. was the only (proper?) way to prevent the highlighting.
>Learn something every day.
>
>>
>>It seems the code Jim's code (THISFORM.Tree.SelectedItem = THISFORM.Tree.Nodes(1)) is trying to do more than just reference. It's trying to assign a node to the reference, which is usually accomodated with a Nodes(xxx).Selected=.t.
>>
>>I wonder what Mr. Nelson is up to, hmmmm..., he has got something up his sleeve.
>
>< s > Nothing, really, except trying to get around a bad problem (and in fact this didn't work and
>THISFORM.Tree.Nodes(1).Selected = .T. is not a satisfactory solution either BUT it does solve the hang problem which is even more important!
>
>I expected that, after Init(), the Treeview would have the Top (not necessarily Nodes(1)) highlighted and that THEREFORE THISFORM.Tree.SelectedItem would be a VALID pointer to that first highlighted tree node.
>And it is EXCEPT when another form has been run, at which time .SelectedItem does NOT apparently have a valid node reference in it.
>
>SNIP
Imagination is more important than knowledge
Previous
Reply
Map
View

Click here to load this message in the networking platform