2

I am trying to make a combo box which contains a lot of items. Due to its length it hits the bottom of the screen. Here is an example of what happens when it hits the bottom of the screen:

combo box in GTK4, it doesn't allow scrolling

There are 80 items in the combo box, but it can only display those five items, with the fifth being slightly cut off, as there's no vertical scroll bar which can allow for scrolling through the options.

In the UI file I have:

<child>
  <object class="GtkComboBoxText" id="acc1_combo_box">
    <property name="visible">True</property>
    <property name="sensitive">False</property>
    <property name="can-focus">False</property>
  </object>
  <packing>
    <property name="expand">False</property>
    <property name="fill">True</property>
    <property name="position">1</property>
  </packing>
</child>

After doing some tests using Glade, I found out that GTK3's combo boxes will allow for scrolling when the combo box hits the bottom of the screen (indicated here by the downwards arrow):

combo box in gtk3 using glade

How do I make the combo boxes scrollable? Is there an alternative, or should I just convert my code to use GTK3, as it does have scrollable combo boxes?

hopital
  • 53
  • 1
  • 6
  • I can't speak for GTK4, because I've never used it, but using GTK3 should be okay for now; I don't think it's deprecated. – Sylvester Kruin Sep 27 '21 at 19:43
  • I have exactly the same problem. I have a GTK4 ComboBox with approx 100 items. Popup Window only shows the middle items and can't be scrolled with mouse or anything. GTK3 ComboBoxes are scrollable. – eminfedar Jul 02 '22 at 13:12

1 Answers1

2

GtkComboBox uses GtkTreeview-based technology which is quite deprecated in GTK4 and there are various regressions from GTK3 that no body cared enough to fix.

Do you really need to use GtkCombobox instead of GtkDropDown which uses the actively developed GtkListView-based technology (and supports scrolling)?

The only legitimate reason to use GtkComboBox would be because it doesn't support tree-like navigation, (which you don't seem to need based on your examples), you can see examples of people's problems with GtkComboBox in GTK4 mentioned here and here

Teipekpohkl
  • 176
  • 2