Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
List box problem...
Message
De
26/08/2002 17:07:06
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00693827
Message ID:
00693851
Vues:
18
Thanks... looks like you are doing the same thing as I am. It still don't know why I only get the last item selected.

>Hi Bob,
>
>I have such class implemented. See this code (List_Arg is the comma-delimited string of selected values, listbox has an array as it's RowSource):
>
>********************************************************************
>*  Description.......: BTCC_MultiList.BTC_ListSelect: method to select a comma-delimited list of codes
>*  Calling Samples...:
>*  Parameter List....: list_arg
>*  Created by........: MDA
>*  Modified by.......: Nadya Nosonovsky 01/14/2000 04:07:16 PM
>********************************************************************
>* 8/4/99: Adapted from preliminary logic for handling the Counties listbox.
>* 12/14/99 NN changed the code to better handle lots of items selected (AT instead of INLI)
>* This method is used for state-saving/restoration of the listbox.
>*
>* Note that the behavior of this method is additive, to allow for anticipated need to
>* split up steps due to VFP's 256 character macro/expression length limit.
>lparameters list_arg	&& takes 1 required arg
>* list_arg:				list of codes, in a form suitable for arglist to inlist().
>with this
>	if alen(.btcValArray) <= 1		&& array is empty
>		return							&& no-op
>	endif
>	if empty(m.list_arg)
>		list_arg=.btcCrit
>	endif
>	local n, lnSel,  lnCodes, lnLen
>* check for empty array special case
>	lnLen=alen(.btcValArray, 1)
>* loop over the array, checking each item against the given list
>	for n = 1 to m.lnLen				&& cycle over rows
>		if at(.btcValArray[m.n, 2], m.list_arg)>0     && this item is to be selected
>			.Container1.List1.selected(m.n) = .t.	&& flag list item as Selected
>		endif
>	endfor
>	if !empty(.TableName)
>		lnSel=select() && save current area
>		select (.TableName)
>		if reccount()<1 and !empty(m.list_arg) && First time
>			local array laCodes[1]
>			lnCodes=aparser1(@laCodes, m.list_arg,',')
>			for i=1 to m.lnCodes
>				insert into (.TableName) values (laCodes[i])
>			next
>			if !empty(.InputClass)
>				lObj=evaluate('this.container1.'+.InputClass+'1')
>				lObj.requery()
>			endif
>		endif
>		select (m.lnSel) && return to previous area
>	endif
>endwith
>
>>>
>>>LPARAMETERS cObjName, cSelected
>>>
>>>LOCAL oObj AS ListBox, i
>>>
>>>oObj = EVALUATE("This."+cObjName)
>>>
>>>FOR i = 1 TO oObj.ListCount
>>>	IF ALLTRIM(oObj.ListItem[i,2]) $ cSelected
>>
>>* I have tried Selected and SelectedID here, neither works.
>>
>>>		oObj.SelectedID[i] = .T.
>>>	ENDIF
>>>ENDFOR
>>>
>>>RETURN
>>>
>>>
>>>Any help would be apreciated.
>>>
>>>BOb
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform