I think I got you wrong. Assuming you have a schema to create a unique key per record navigated and you know its parent key :
lcKeyNew = 'SomeNewKey'
lcKeyParent = 'ParentKey'
lcText = 'NodeText'
if type('TV.Nodes(lcKey)')#'O'
if empty(lcParentKey)
TV.Nodes.Add(,0,lcNewKey,lcText)
else
TV.Nodes.Add(lcParentKey,4,lcNewKey,lcText)
endif
endif
TV.Selecteditem = TV.Nodes(lcNewKey)
TV.Nodes(lcNewKey).Expanded = .t.
TV.Nodes(lcNewKey).Ensurevisible
Cetin
>Hi Cetin
>
>Thanks for your response but sorry I cannot really understand what will happen and EnsureVisible I am totally at lost.
>
>I have functions like BuildTree and SynchronizeTreeView etc. How will the three lines do the pouplating of my treeview. I have borrowed a lot of codes from 2 different places to get this one working for me using CodeBook.
>
>>>On a form I have a TreeView and navigationable TextBoxes. I have sparse populated the TreeView as the no. of node can go high, now if I use the TreeView for navigation then alls well.
>>>
>>>If I navigate using the toolbar for the form, though the TV will highlight the right records if populated (by user interaction) but for the none populated nodes the TV is confused.
>>>
>>>Any logic to make a sparse TV to populate on record movement rather than clicking on the pluses and minuses
>>>
>>>Thanks in advance
>>
>>TV.Selecteditem = TV.Nodes(NodeKey)
>>TV.Nodes(NodeKey).Expanded = .t.
>>TV.Nodes(NodeKey).Ensurevisible
>>
>>Cetin