Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to allow users to rename the item in the list box.
Message
De
13/11/2002 15:18:02
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00721778
Message ID:
00722334
Vues:
16
I think you still need the index. SelectedId() returns .T. or .F. based on SelectedId(nIndex).

Also, if your list is sorted, the id gets messed up and SelectedID(3), for instance, could return what, to the user, looks like item 5 or 10 or whatever. I guess that would likely not matter much, but it feels counterintuitive to me (on a sorted list).

Alan

>>This depends entirely on where your rowsource comes from - ie - the RowSourceType. Even assuming your RowSourceType is simply 'Value', your second last line doesn't refer to the item being changed. Again, assuming a RowSource Type of 'Value', try this in the RightClick():
>>
>>
>>LOCAL llOk, lnCount
>>llOk = .F.
>>
>>* find out if anything is actually selected
>>FOR lnCount = 1 TO This.ListCount
>>   IF This.Selected(lnCount)   && ok, something is
>>      llOk = .T.
>>      lnSelected = lnCount     && set a variable to the index
>>      lnCount = This.ListCount && break out of the loop
>>   ENDIF
>>ENDFOR
>>
>>IF llOk
>>   lcNewName = INPUTBOX("New Name:")  && get new input
>>   IF !EMPTY(lcNewName)               && ignore if empty
>>      This.List(lnSelected) = lcNewName  && change value of the selected item
>>   ENDIF
>>ENDIF
>>This.Refresh()   && refresh the listbox
>>
>>
>
>You don't need the first loop, I believe SelectedID is the property. However, in my Help Selected and SelectedID have the same description. Are they really the same or it's a bad Help (July 1999 MSDN)?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform