Recent

Author Topic: TComboBoxEx & TCheckComboBox - how do they work?  (Read 6358 times)

JD

  • Hero Member
  • *****
  • Posts: 1848
TComboBoxEx & TCheckComboBox - how do they work?
« on: January 12, 2016, 12:38:31 pm »
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
Windows - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe),
Linux Mint - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe)

mORMot; Zeos 8; SQLite, PostgreSQL & MariaDB; VirtualTreeView

balazsszekely

  • Guest
Re: TComboBoxEx & TCheckComboBox - how do they work?
« Reply #1 on: January 12, 2016, 01:10:01 pm »
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

  • Hero Member
  • *****
  • Posts: 3237
  • POKE 54296,15
    • Eye-Candy Controls
Re: TComboBoxEx & TCheckComboBox - how do they work?
« Reply #2 on: January 12, 2016, 02:52:21 pm »
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.
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

balazsszekely

  • Guest
Re: TComboBoxEx & TCheckComboBox - how do they work?
« Reply #3 on: January 12, 2016, 04:44:13 pm »
@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.     
« Last Edit: January 12, 2016, 04:48:20 pm by GetMem »

JD

  • Hero Member
  • *****
  • Posts: 1848
Re: TComboBoxEx & TCheckComboBox - how do they work?
« Reply #4 on: January 12, 2016, 05:35:56 pm »
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
Windows - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe),
Linux Mint - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe)

mORMot; Zeos 8; SQLite, PostgreSQL & MariaDB; VirtualTreeView

wp

  • Hero Member
  • *****
  • Posts: 11858
Re: TComboBoxEx & TCheckComboBox - how do they work?
« Reply #5 on: January 12, 2016, 05:38:21 pm »
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

  • Hero Member
  • *****
  • Posts: 3237
  • POKE 54296,15
    • Eye-Candy Controls
Re: TComboBoxEx & TCheckComboBox - how do they work?
« Reply #6 on: January 12, 2016, 06:53:18 pm »
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).
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

balazsszekely

  • Guest
Re: TComboBoxEx & TCheckComboBox - how do they work?
« Reply #7 on: January 13, 2016, 09:36:12 am »
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

  • Hero Member
  • *****
  • Posts: 1848
Re: TComboBoxEx & TCheckComboBox - how do they work?
« Reply #8 on: January 13, 2016, 12:47:56 pm »
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

@GetMem
Thanks a lot for this. It was exactly what I was planning to do.

JD
Windows - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe),
Linux Mint - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe)

mORMot; Zeos 8; SQLite, PostgreSQL & MariaDB; VirtualTreeView

balazsszekely

  • Guest
Re: TComboBoxEx & TCheckComboBox - how do they work?
« Reply #9 on: January 13, 2016, 01:04:18 pm »
@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.

 

TinyPortal © 2005-2018