TComboBoxEx & TCheckComboBox - how do they work? lazarus / 31-LCL ---------------------------------------------------------------------- JD · 2016-01-12 11:38 Hi there everyone, I'm curious to know how more about how TComboBoxEx & TCheckComboBox work? I see that TComboBoxEx permits adding images but I'd like to know how it works. I don't get why TCheckComboBox permits checking multiple options yet displays only one option in the edit field. Thanks, JD ---------------------------------------------------------------------- balazsszekely · 2016-01-12 12:10 Hi JD, 1. TComboBoxEx    Add a TImageList to your form, assign TImageList to TCombobBoxEx Images property. Add a few ItemEx, and set each ItemEx ImageIndex property. 2. TCheckComboBox     I guess you can store one extra info in the checkboxes(if needed), but you're right, it's counter intuitive. regards, GetMem ---------------------------------------------------------------------- Blaazen · 2016-01-12 13:52 I developed those two components some time ago and I can tell that it was not easy to make it (even more: make it cross-platform) because you don't have full control and no mouse events over the drop-down menu, you can click just once. So it's a compromise. ---------------------------------------------------------------------- balazsszekely · 2016-01-12 15:44 @Blaazen Those are great components, especially TComboBoxEx. TCheckComboBox is also good, I don't have problem with multiple clicks(what you mentioned as a compromise), I just don't understand the logic. Let's say we have five items, four of them is checked(0, 2, 3, 4), the ItemIndex is 0(the first one is displayed). Now which counts? The checked items, the displayed item or both? I think this is also the OP's question. ---------------------------------------------------------------------- JD · 2016-01-12 16:35 Yes Blaazen. The components are great. I thought about using TComboBoxEx when I wanted to have a combobox with countries & their flags. I was just looking for examples of their proper usage. JD ---------------------------------------------------------------------- wp · 2016-01-12 16:38 I've seen a component similar to TCheckCombobox in which the edit field displays a semicolon (or whatever)-separated list of the checked items, i.e., if the combobox contains items "Red", "Green", "Blue", "Yellow", and "Red" and "Yellow" are checked then the edit line displays the text "Red;Yellow" (without a checkbox). ---------------------------------------------------------------------- Blaazen · 2016-01-12 17:53 Now it works this way: Let's say you have 5 items (Count=5). You dropdown list, click the third item. Now (ItemIndex=2), and the third item is selected. You can change this item without dropping down the list. Known limitations: You cannot sort items (it will mess checkboxes and captions). You cannot change state of selected item in dropdown menu (you have to click selected item directly when combo is closed). ---------------------------------------------------------------------- balazsszekely · 2016-01-13 08:36 Quote@JD I thought about using TComboBoxEx when I wanted to have a combobox with countries & their flags.Take a look at this: https://drive.google .com/file/d/0B9Me_c5onmWoeUdIT1ctbnJ2UzA/view?usp=sharing ---------------------------------------------------------------------- JD · 2016-01-13 11:47 Quote from: GetMem on January 13, 2016, 09:36:12 amQuote@JD I thought about using TComboBoxEx when I wanted to have a combobox with countries & their flags.Take a look at this: https://drive.google .com/file/d/0B9Me_c5onmWoeUdIT1ctbnJ2UzA/view?usp=sharing @GetMem Thanks a lot for this. It was exactly what I was planning to do. JD ---------------------------------------------------------------------- balazsszekely · 2016-01-13 12:04 @JD You're welcome! I just noticed: 1. Form 222 to 225 the order are switched. Please make the necessary adjustments. 2. The autocomplete features are not working at my side. It would be nice if, for example type f, then the first country with f would appear. ---------------------------------------------------------------------- pmralbuquerque · 2026-05-09 15:24 Quote from: Blaazen on January 12, 2016, 06:53:18 pmNow it works this way: Let's say you have 5 items (Count=5). You dropdown list, click the third item. Now (ItemIndex=2), and the third item is selected. You can change this item without dropping down the list. Known limitations: You cannot sort items (it will mess checkboxes and captions). You cannot change state of selected item in dropdown menu (you have to click selected item directly when combo is closed). I know this is an old post, please forgive. @blaazen, thank you for these. Let's say I have 5 items in TCheckComboBox. I want to loop through those 5 items and concat all checked items in a string. Something like this: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i for Counter := 0 to cbCheckProjects.Count do    begin      if cbCheckProjects.ItemIndex[Counter].Checked then  // Illegal qualifier error         ProjectList += ',' + cbCheckProjects.ItemIndex[Counter].Text;    end;  Is this possible? Thank you in advance, Pedro ---------------------------------------------------------------------- Paolo · 2026-05-09 16:05 Something like this compile ? Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i for Counter := 0 to cbCheckProjects.Count-1 do  // added -1    begin      if cbCheckProjects.Items[Counter].Checked then  // items instead of your itemindec         ProjectList += ',' + cbCheckProjects.Items[Counter].Text; // as above    end; ---------------------------------------------------------------------- pmralbuquerque · 2026-05-09 16:13 Thank you for your time Paolo. No, illegal qualifier is still there. I should have said that Checked is my wishfull thinking, pseudo code. Not sure if there is such a possibility. ---------------------------------------------------------------------- Paolo · 2026-05-09 17:10 This ? Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i    If  cbCheckProjects.Checked[I] then... ---------------------------------------------------------------------- pmralbuquerque · 2026-05-10 05:31 Paolo, That did it, perfect, many thanks. It ended like so: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i for Counter := 0 to cbCheckProjects.Count-1 do    begin      if cbCheckProjects.Checked[Counter] then         ProjectList += ',' + cbCheckProjects.Items[Counter];    end; ---------------------------------------------------------------------- Paolo · 2026-05-10 09:28 Good.