Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to allow users to rename the item in the list box.
Message
 
 
To
13/11/2002 14:18:16
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00721778
Message ID:
00722325
Views:
27
>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)?

I re-read these descriptions again and now I'm confused. What's the difference between nIndex and nItemID and between Selected and SelectedID. Seems like there is no property, which would return selected ID...
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform