Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Loop through all selected items in a listbox
Message
De
04/01/2000 12:23:41
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00311890
Message ID:
00312510
Vues:
49
>Hi Fred,
>>>>>
>>>>>Sorry for this simple question, but how can I operate with selected item values in a multiselected listbox? Say, I want to remove each selected item (several in one time) from the list, how can I do it?
>>>>
>>>>Since the ListBoxes Selected property is like an array, you could traverse it starting from the end back towards the beginning so as not to disturb the order while you're deleting entries:
>>>>
>>>>FOR x=oListBox.ListCount TO 1 STEP -1
>>>> remove your entry
>>>>ENDFOR
>>>
>>> I put this code in list.RightClick() event and when spent almost 1 hour trying to understand, why it doesn't work. Finally I discovered, that RightClick() loose the current selection and keeps only one item selected. Is there a way to avoid this behavior or RightClick is a bad place to put such code?
>>
>>Nadya,
>>I think you'll have that problem with any method and using the mouse associated with that object. My suggestion would be to have a command button that starts up the deletion process, that way the mouse click on the button won't change the selected items of your ListBox.
>
> Yes, actually I have Add/Remove buttons, but I thought it would be nice to have similar behaviour on Right Click. I was also thinking about del key, say, select several items and then click del - the same result as Remove button. I haven't tried it yet, but think, there should not be a problem. Unfortunately, my manager told me, that the whole new class idea is not important right now, so I have to switch into other tasks. It's a pity :(

Nadya,

When you get back to this class, maybe trying a NODEFAULT in the RightClick code would suppress the problem? I haven't tried this, so good luck!
Fred
Microsoft Visual FoxPro MVP

foxcentral.net
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform