Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ListBox and TreeView Control
Message
From
16/08/2001 12:13:54
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Other
Title:
ListBox and TreeView Control
Miscellaneous
Thread ID:
00544775
Message ID:
00544775
Views:
47
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.
Next
Reply
Map
View

Click here to load this message in the networking platform