I have a picker designed with an ole TreeView Control on the left and a ListBox on the right. All the nodes on the TreeView that contain sufficient data are black and bold, and can be selected. All that do not contain enough data are gray and not bold, and cannot be selected and moved. When a selectable node is clicked, its description and node key are moved to the listbox on the right. The selectable node is then turned from black/bold to gray. After it is moved, it can be removed from the ListBox by clicking on it. When it is removed its corresponding node on the treeview is returned to black/bold.
This all works fine as long as you remove an item from the listbox by clicking on the last item on the list. If you remove an item from the top of the list on the listbox it seems to work. However, when the items are moved up in the listbox to replace the deleted item, the Listbox loses the nodekey of the item directly below the one that has just been removed. When that item is clicked to be removed the TreeView control throws an error complaining about the invalid nodekey, (which is now empty) when i try to rebold the item's corresponding node.
The is ListBox is a 2 column ListBox with no control source and and the Row Source Type is set to 0 (none default).
Here is what my code looks like in the click event of the listbox.
LOCAL lcDescription, lcNode
lcDescription = THIS.Value
lcNode = THIS.List(THIS.ListIndex, 2)
WITH ThisForm.Ctreeviewctrl1.TREEVIEW.NODES(lcNode)
.FORECOLOR = RGB(0,0,0)
.BOLD = .T.
ENDWITH
THIS.RemoveItem(this.ListIndex)
Any ideas of what is causing the ListBox to lose the nodekey when the row is moved up??
Josh Horne
Software Developer
MedAssess Systems
AmerisourceBergen Corp.