Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ListBox and TreeView Control
Message
De
17/08/2001 14:34:15
 
 
À
16/08/2001 13:29:38
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00544775
Message ID:
00545563
Vues:
16
Hi Pam,
I tried your suggestion, and in this circumstance they return the same thing. The index does change after an item is removed, but in this case the user has selected an item and both ListIndex and ListItemID will return a reference to the selected item.

I didn't figure out why the listbox is losing all the values in the second column when the items are reindexed, but I did find a work around fix using a local array. It looks like this:
LOCAL lnColumn, lcNode, laVitals

DECLARE laVitals[1,2] &&array used to store all the vitals that are not being removed

lcNode = This.List(this.ListIndex, 2) && NodeIndex used to bold and un-bold the node on tree

******************************************************************
**	Scan through listbox and stuff all non-selected vitals in the 
**	array
******************************************************************
lnPosition = 1
FOR i = 1 TO this.ListCount 
	IF !THIS.Selected(i)
		laVitals[lnPosition,1] = THIS.List(i, 1)
		laVitals[lnPosition,2] = THIS.List(i, 2)
		lnPosition = lnPosition + 1		
		DIMENSION laVitals[lnPosition,2]
	ENDIF 
ENDFOR
******************************************************************
**	Un-Bold the corresponding node on the tree
******************************************************************
WITH ThisForm.Ctreeviewctrl1.TREEVIEW.NODES(lcNode)
	.FORECOLOR = RGB(0,0,0)
	.BOLD = .T.
ENDWITH
******************************************************************
**	Clear the listbox of all items
******************************************************************
THIS.Clear()

******************************************************************
**	Stuff the items from the array back in the listbox
******************************************************************
FOR i = 1 TO (ALEN(laVitals,1)- 1)
	THIS.AddListItem(laVitals(i,1),i,1)
	THIS.AddListItem(laVitals(i,2),i,2)
ENDFOR
If there is a better way of doing this I would be very interested to know.
Thanks for your help.

Josh
Josh Horne
Software Developer
MedAssess Systems
AmerisourceBergen Corp.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform