Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can I detect the user has selected in a multiselect List
Message
From
23/05/2001 18:38:24
 
 
To
23/05/2001 14:17:24
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00510516
Message ID:
00510646
Views:
12
Ok, George, the simplest way is the following. But, if you have a huge number of entries in the listbox it may bog down.....
** Listbox.InterActiveChange code
ThisForm.cmdButton.Refresh()
****
** cmdButton.Refresh
nSelCount=0
lEnabled=.F.
FOR i = 1 TO ThisForm.Listbox.ListCount
   IF ThisForm.Listbox.Selected(i)
      nSelCount=nSelCount+1
      IF nSelCount >= 2
         lEnabled=.T.
      ENDIF
   ENDIF
ENDFOR
This.Enabled=lEnabled
>Hi, all!
>
>Here is my problem:
>
>I have a multiselect listbox on a form. There is also a command button on the form. The command button should only be enabled if two or more list items are selected.
>
>Is there any event which fires as list items are selected/unselected?
>
>I tried putting some code in the mousedown/mouseup events. This works unless the user uses the keyboard to select items.
>
>I also tried creating a custom listbox class, with a selected_assign() method. This method doesn't seem to ever fire. I was hoping that as the selected() property of the listbox changed, the assign method would fire. But it doesn't.
>
>Any ideas?
>
>- George
------------------------------------------------
John Koziol, ex-MVP, ex-MS, ex-FoxTeam. Just call me "X"
"When the going gets weird, the weird turn pro" - Hunter Thompson (Gonzo) RIP 2/19/05
Previous
Reply
Map
View

Click here to load this message in the networking platform