Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multi select list box

Status
Not open for further replies.

crewchiefpro6

Programmer
Mar 22, 2005
204
US
I am having trouble understanding the multi select listbox. Since I now need one I was wondering if there is an easy way to create one, I really do not want to just drop a class in, I want to understand the workings of one.

I downloaded a few classes as prg files, but I want to create one myself on a form.



Don Higgins
 
The listbox control that comes with Visual FoxPro comes with the ability to do multiselect. Just set the multiselect property to 1. Mutliple items can be selected using the ctrl key and left mouse clicks (basic Windows conventions apply). Then loop through the items in the listbox and check their selected property to see which ones the user selected. There's an example of this in the VFP Help file under the "MultiSelect Property" topic.

Now, if what you wanted was to simulate checkboxes or something in order to show multiple selections, then there is FAQ I wrote that should help you understand the concept and code involved. Here's the link:

Simulating checkboxes in a listbox
faq184-3911


boyd.gif

SweetPotato Software Website
My Blog
 
Thanks Craig,
I actually downloaded your code and was trying to transfer it to a form to make a class but was unabled to figure out the check marks next to the rows. Can't seem to figure out what you did to make them appear in a form without running the prg code.



Don Higgins
 

Then loop through the items in the listbox and check their selected property to see which ones the user selected.

Just to clarify that. The Selected property is in fact an array. Each element in the array corresponds to one of the items in the list. The element is .T. if the item is selected, othewise it's .F.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top