Listbox control question

Started by Martin Francom, December 31, 2010, 09:18:42 PM

Previous topic - Next topic

Martin Francom

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?

Paul Squires

WindowStyles -->  Single Select
Paul Squires
PlanetSquires Software

Martin Francom

Thanks Paul,  I missed seeing that setting.

Martin Francom

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.

Paul Squires

??

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.
Paul Squires
PlanetSquires Software

Martin Francom

Paul,
   Here's the ListBox program example  (I must have gotton it from someone here)  Very simple example program.

Paul Squires

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.
Paul Squires
PlanetSquires Software

Martin Francom

Oh, Ok... I will give that a try.