PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Martin Francom on December 31, 2010, 09:18:42 PM

Title: Listbox control question
Post by: Martin Francom on December 31, 2010, 09:18:42 PM
I would like the listbox to allow only one selected item.  If an item is selected any previously selected item will be unselected.  How do accomplish that?   Is there a setting in the ListBox properties that force the selection of only one item?
Title: Re: Listbox control question
Post by: Paul Squires on December 31, 2010, 09:32:20 PM
WindowStyles -->  Single Select
Title: Re: Listbox control question
Post by: Martin Francom on January 01, 2011, 04:24:32 PM
Thanks Paul,  I missed seeing that setting.
Title: Re: Listbox control question
Post by: Martin Francom on January 01, 2011, 04:37:46 PM
Paul,
   That did not work...
   Just set the "Single Select" property in the Windows Styles for the ListBox control and it made no difference.  I was still able to select multiple items and multiple items were returned.  Note: I am working with the ListBox sample program.
Title: Re: Listbox control question
Post by: Paul Squires on January 01, 2011, 09:46:18 PM
??

You have me confused. What ListBox sample program? FF3 does not come with a ListBox sample program.

You should post the code you are using so that we are on the same page.
Title: Re: Listbox control question
Post by: Martin Francom on January 02, 2011, 01:15:25 PM
Paul,
   Here's the ListBox program example  (I must have gotton it from someone here)  Very simple example program.
Title: Re: Listbox control question
Post by: Paul Squires on January 02, 2011, 04:11:40 PM
Well, that is something different than a standard ListBox. You are adding checkboxes and manually displaying the checked status via the custom draw. The check status seems to be stored in the itemdata are of each listbox item. You would need to reset the itemdata for all listbox items whenever the selection changes and only set the itemdata for the curren tite,. That way, when the item draws it will only draw the check mark for the current item.
Title: Re: Listbox control question
Post by: Martin Francom on January 02, 2011, 07:51:54 PM
Oh, Ok... I will give that a try.