Combo box with images

Hi, how can I add images to combo box entries using gtkmm 4?
Thx

I decided to implement it myself following an example in ComboBox with an Entry.
The drop down lit shows my image, but when the combo is closed only the text is visible.
image
In the text example they call set_entry_text_column(), what is the method for showing the entire row? I don’t care about editing capabilities

In GTK4 it’s suggested to use DropDown instead of ComboBox, the Lists/Selections demo shows an example of how to do this with icons. I think the gtkmm 4 docs still might need to be updated for the new list model widgets.

That’s great, thx!
I found a c++ version too: gtkmm: demos/gtk-demo/example_dropdown.cc | Fossies
As far as I can see this example works with gtk icons. Can I add my own image to a drop down?

In that example, instead of image->set_from_icon_name you could do image->set with a filename or pixbuf. And you may want to replace the Gtk::Image with a Gtk::Picture, I think that might work better for arbitrary images.

That’s great, THX for your help!!!

…one more question: how can I add a scroll bar to the drop down list? How do I access it from the drop down class? gtkmm: Gtk::DropDown Class Reference

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.