Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
MoverListBox with MoverBars = .T.
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
The Mere Mortals Framework
Divers
Thread ID:
00890604
Message ID:
00890967
Vues:
23
OK, I worked through the ListToItemID stuff. I don't think it turned out to be any more "elegant" that my first solution, but here it is:
****************************************************************
*   This is the code where I'm using IndexToItemID
*-- LW 3/30/2004 - added lnRow to correctly remove
*                  items whose position had been changed
*                  by MoverBar in the selected array

LOCAL lcArray, lnRow
LOCAL laArray[1]

lcArray = oSource.RowSource
=ACOPY(&lcArray,laArray)

FOR lnCounter = 1 TO oSource.ListCount

	IF oSource.Selected(lnCounter) AND !oSource.Isdimmed(lnCounter)

		*Get the ItemID for the selected entry from the RowSouce array. If it has been moved in the selected list, 
                  *the row in the list will not be the same and the wrong row will be duplicated by the DupeRow method below.
                  *Get the current row number for that ItemID.
		IF oSource.MoverBars 
			
                           *What is the ItemID of the selected item?
			lnItemID = oSource.IndexToItemID(lnCounter)
			
                           *find the Item ID in the original array (column 2 stores the Item ID)
                           * and return the row number where it originally appeared
			lnRow = ASCAN(&lcArray, lnItemID,1,-1,2,8)
		ELSE
			*if there are no mover bars, the Index will be equal to the actual position
			lnRow = lnCounter
		ENDIF

		* change subsequent reference from lnCounter in the original framework to lnRow
		oSource.DupeRow(@laSource, lnRow)

		THIS.AddItemToRowSourceArray(@laSource, .T.)
		IF THIS.RowSourceType = 0
			THIS.AddListItem(laSource[1,1], laSource[1, 2])
		ENDIF

		* change subsequent reference from lnCounter in the original framework to lnRow
		oSource.MarkRow(lnRow)  

	ENDIF

ENDFOR
I'm going to stick with my original fix since it seems to do the same job with fewer steps, but stash this alternative somewhere in case problems turn up with the first solution. Meanwhite, this technique may help solve a problem someone else is having.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform