ComboBox with checkbox items

13,275

Solution 1

We have used the following components in our different projects:

Freeware:

Commercial:

  • TcxCheckComboBox from DevExpress

Solution 2

  1. You can write your own component

  2. You can simulate the checkboxes using stock TComboBox in OwnerDraw mode and drawing both item titles and checkboxes by your custom routine

  3. You can simulate the checkboxes using stock TComboBox using UNICODE symbols for checkboxes: http://en.wikipedia.org/wiki/Checkbox#Unicode

  4. You can avoid using TCombobox but instead put TCheckList over some kind of collapsible panel with caption. Those components together might provide user experience rather close to checked combobox

  5. You can take any of many ready-made components and libraries. For example

Combobox that shows a checkboxlist when expanded. Several options can be selected there, selected lines are shown as comma-separated-text in combobox. Access via properties "ItemEnabled[i]" and "Checked[i]"

PS. I used D2009 and that is an ultimately buggy Delphi version, both IDE and compiler and RTL. I seriously suggest you to either upgrade or downgrade.

PPS. You question is very very close to the "list the libraries" one, which is offtopic on StackOverflow: https://stackoverflow.com/help/dont-ask

Share:
13,275
Alec
Author by

Alec

I love code, everything that has to do with code...I love it

Updated on June 04, 2022

Comments

  • Alec
    Alec almost 2 years

    Please advise, I'm still very new to Delphi. I would like to have a ComboBox with checkbox items, what can I use or do? I'm using Delphi 2009.

    • Arioch 'The
      Arioch 'The over 10 years
      wiki.delphi-jedi.org/wiki/JVCL_Help:TJvCheckedComboBox Combobox that shows a checkboxlist when expanded. Several options can be selected there, selected lines are shown as comma-separated-text in combobox. Access via properties "ItemEnabled[i]" and "Checked[i]"
    • Marcus Adams
      Marcus Adams over 10 years
      A combobox doesn't have checkbox items. If you explain what you're using it for, maybe we can suggest a more natural/intuitive design.
    • Alec
      Alec over 10 years
      Thanks, the TJvCheckedComboBox is what I just need.
    • mistertodd
      mistertodd over 9 years
      @MarcusAdams When you combine a Windows Edit control with a ListBox control, you get the standard DropDown control. We want to combine a Windows Edit control with a Checked ListBox control. For an example of this, open Windows Explorer and click the drop-down arrow on the right side of any header column. Blango! Drop-down+checkable items.
  • TLama
    TLama over 10 years
    Ad 2. and 3., I don't think it would be easy for implementation. Consider how would you control such owner drawn check boxes. Don't forget that if you click the drop down list, the item under the cursor is selected and drop down list hidden. That would be very uncomfortable for check list box. Ad Delphi 2009, except serious problems with generics I cannot say anything wrong about it. Nothing can be worse than Delphi 2005 :-)
  • Arioch 'The
    Arioch 'The over 10 years
    @TLama the question was not "suggest me easy library" but a "what can i do" (if you disagree - flag the question as offtopic). Also i think you're wrong. #3 is the most easy to do (the most flatten learning curve - nothing to learn at all) // D2009 also has a lot of troubles debugging multithreaded apps. I did not use D2005, but i saw D2006. It was a poor choice as well. But they say D2007 was a decent release.
  • TLama
    TLama over 10 years
    So then tell me how do you check e.g. 3 items in such combo check list box, if you just draw icons. You will popup the drop down list three times ? Uhm, quite user unfriendly, I'd say. And, you're lucky you haven't met D2005 :-)
  • Arioch 'The
    Arioch 'The over 10 years
    @TLama hey, you told "easy for implementation" above! Don't switch subject to "ease of use" and "GUI Guidelines" - we don't have them neither in the question nor in your starting comment. // Well, actually i avoided all those new versions for serious work until XE2. Before that i was stuck with D5 release :-D. Short affair with D2009 only proved me i was right :-)
  • TLama
    TLama over 10 years
    Sorry, surely I meant easy to implement an easy to use check list combo box.
  • mistertodd
    mistertodd over 9 years
    @TLama If you want to see a checked drop-down list in action: open Windows Explorer. On the right side of each listview header column is a checked drop-down. That is the behaviour the user intuitively expects.
  • TLama
    TLama over 9 years
    @Ian, thanks! Didn't know about it (I'm not using Windows Explorer).