Recent

Author Topic: Can TComboBoxEx.ItemWidth increase the width of the Itemlist? (Linux)  (Read 636 times)

Hartmut

  • Sr. Member
  • ****
  • Posts: 423
Versions:
 - Lazarus 2.0.6 / FPC 3.0.4 and Lazarus 1.8.4 / FPC 3.0.4 (both gtk2)
 - Linux Ubuntu 18.04 (64-bit)

I have a ComboBoxEx with a couple of items, which are longer then ComboBoxEx.Width. When I "open" the ComboBoxEx by clicking on the DropDown-Arrow, the list of all items is displayed, but it's width is too small to see the items completely.

It would be "nice to have" to increase the width of the opened Itemlist, but without having to increase ComboBoxEx.Width (because I have a couple of controls in 1 horizontal line and don't want to consume permanently more width).

I found property ComboBoxEx.ItemWidth and the documentation says "The minimum width of the items in the drop-down list". It's default is 0 and I played with it, but it does not change the width of the opened Itemlist.

On Windows it works to increase the width of the opened Itemlist by ComboBoxEx.ItemWidth, but not on Linux.

My question:
Is this one more bug in ComboBoxEx on Linux or must I only go another (easy) way to "enable" this feature on Linux?

Please notice, that this is only a "nice to have" for me:
 - if this feature is implemented and works and I can "enable" it in a couple of minutes, I would like to use it.
 - what I definitely not want is, e.g. to draw the Itemlist by my own (or something with similar effort), because I'm still a beginner to the LCL and would need many hours or days until it works and (at this moment) I don't want to invest this time (have enough other problems of higher prio).
 
Thanks in advance for your help.

Blaazen

  • Hero Member
  • *****
  • Posts: 2902
  • POKE 54296,15
    • Eye-Candy Controls
Re: Can TComboBoxEx.ItemWidth increase the width of the Itemlist? (Linux)
« Reply #1 on: August 07, 2020, 05:10:42 pm »
ItemWidth does nothing on Linux+Qt. I don't think it is a bug, simply Qt widgetset does not support it and the property is there for Delphi compatibility.
Lazarus 2.1.0 r63881 FPC 3.3.1 r40507 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/

Hartmut

  • Sr. Member
  • ****
  • Posts: 423
Re: Can TComboBoxEx.ItemWidth increase the width of the Itemlist? (Linux)
« Reply #2 on: August 07, 2020, 06:08:40 pm »
Thanks Blaazen, for your reply. But I use gtk2, not Qt. Does gtk2 also not support this feature (or would this be a bug)?

dsiders

  • Sr. Member
  • ****
  • Posts: 370
Re: Can TComboBoxEx.ItemWidth increase the width of the Itemlist? (Linux)
« Reply #3 on: August 07, 2020, 06:50:27 pm »
Thanks Blaazen, for your reply. But I use gtk2, not Qt. Does gtk2 also not support this feature (or would this be a bug)?

I'm no GTK expert, so take this with a grain of salt...

There is code in the implementation of TGtk2WidgetSet.SetComboMinDropDownSize. It tries to get a "Menu" object instead of a combo box, and never calls gtk_combo_box_set_wrap_width. It handles it as a widget size request.

If the existing code doesn't work, then it's a bug IMO.
Lazarus 2.1 (SVN) / FPC 3.0.4 / FPC 3.2.0 / x86-win64 / Windows 8.1

Hartmut

  • Sr. Member
  • ****
  • Posts: 423
Re: Can TComboBoxEx.ItemWidth increase the width of the Itemlist? (Linux)
« Reply #4 on: August 07, 2020, 08:16:34 pm »
Thanks dsiders, for that informations. I will wait if there are more opinions and if I'll write a bug report, I will add your informations.

bytebites

  • Sr. Member
  • ****
  • Posts: 299
Re: Can TComboBoxEx.ItemWidth increase the width of the Itemlist? (Linux)
« Reply #5 on: August 07, 2020, 08:37:05 pm »
https://developer.gnome.org/gtk2/stable/GtkComboBox.html#gtk-combo-box-set-wrap-width

gtk-combo-box-set-wrap-width sets the column count of the combobox.

Hartmut

  • Sr. Member
  • ****
  • Posts: 423
Re: Can TComboBoxEx.ItemWidth increase the width of the Itemlist? (Linux)
« Reply #6 on: August 08, 2020, 09:29:40 am »
Thanks bytebites, for your reply. But to be honest, I have absolutely no idea, what you want to tell me with that (I'm a bloody beginner to all that stuff).

Looks to me like C style. Is this a part of the sources of which gtk2 is build? How would this help me?
Or is this some kind of "library" which you suggest that I should use it?
If yes, would this be a supplement to TComboBoxEx, that TComboBoxEx acts as desired or would I have to replace TComboBoxEx completely with this new "library"?

jamie

  • Hero Member
  • *****
  • Posts: 3507
Re: Can TComboBoxEx.ItemWidth increase the width of the Itemlist? (Linux)
« Reply #7 on: August 08, 2020, 09:21:21 pm »
Maybe it should be reported so it can get fixed

It is the TCombobox that is causing it obviously..

btw, I reworked that Component "TComboBoxEx" a little but not 100% happy with it, I could drop the modified files here for some one to experiment with..
The only true wisdom is knowing you know nothing

Hartmut

  • Sr. Member
  • ****
  • Posts: 423
Re: Can TComboBoxEx.ItemWidth increase the width of the Itemlist? (Linux)
« Reply #8 on: August 09, 2020, 06:09:05 pm »
Thanks jamie, for that info.
Meanwhile I found out, that standard TComboBox on Linux adapts the width of the opened Itemlist automatically to the item with the maximum length. I'll write a bug report for TComboBoxEx as soon as I find the time to do it including a demo.

jamie

  • Hero Member
  • *****
  • Posts: 3507
Re: Can TComboBoxEx.ItemWidth increase the width of the Itemlist? (Linux)
« Reply #9 on: August 09, 2020, 07:30:23 pm »
that still could be a widget issue..

The comobox normally is not in OWNERDRAW mode but the EX version is in OWERNER draw mode

The widget may not to handling the sizes correctly..

 You should try the standard combobox in OwnerDraw Mode and see if will expand the width for you.
The only true wisdom is knowing you know nothing

Hartmut

  • Sr. Member
  • ****
  • Posts: 423
Re: Can TComboBoxEx.ItemWidth increase the width of the Itemlist? (Linux)
« Reply #10 on: August 10, 2020, 07:24:47 pm »
that still could be a widget issue..
The comobox normally is not in OWNERDRAW mode but the EX version is in OWERNER draw mode
The widget may not to handling the sizes correctly..
I'm not sure what this "means" exactly. Should I create a bug report or not? What would you recommend? I cannot estimate that...

Quote
You should try the standard combobox in OwnerDraw Mode and see if will expand the width for you.
As I wrote above, standard TComboBox on Linux adapts the width of the opened Itemlist automatically to the item with the maximum length, which is very comfortable.

jamie

  • Hero Member
  • *****
  • Posts: 3507
Re: Can TComboBoxEx.ItemWidth increase the width of the Itemlist? (Linux)
« Reply #11 on: August 10, 2020, 09:19:06 pm »
Yes understood however. The question was did u try that in ownerdatw mode?

The ex version is always in owner draw mode so that means the os does not draw it.

The stock combo box is not in owner draw mode and that was my point, it maybe related to ownet draw mode and therefor will effect both of them, not just the ex version.
The only true wisdom is knowing you know nothing

Hartmut

  • Sr. Member
  • ****
  • Posts: 423
Re: Can TComboBoxEx.ItemWidth increase the width of the Itemlist? (Linux)
« Reply #12 on: August 11, 2020, 07:17:28 pm »
Hello jamie, you asked me to test standard "TComboBox" in owner draw mode. Here are the results:

a) Lazarus 1.8.4 / FPC 3.0.4 on Linux Ubuntu 18.04 (64-bit):
For Style = csOwnerDrawFixed and csOwnerDrawVariable the opened Itemlist itself is drawed, but empty (no text is displayed) and the width of the Itemlist is the same as TComboBox.Width (so it is not expanded to the longest item).

b) Lazarus 2.0.6 / FPC 3.0.4 on Linux Ubuntu 18.04 (64-bit):
For Style = csOwnerDrawFixed and csOwnerDrawVariable the opened Itemlist is displayed normally (with all item text's shown) and the width of the Itemlist is also the same as TComboBox.Width (so it is not expanded to the longest item).

Does this mean "the OS does not draw it" => it is a bug in the LCL and so I should create a bug report for it?

 

TinyPortal © 2005-2018