Re: ComboBox with some entries not selectable or grayed out



The attached file shows one way to gray out a row in a combo box. I've added a bool column to the TreeModel and connected it to the CellRenderer's "sensitive" property. Search for "//!!". It shows where I've modified the combobox/complex example in the gtkmm tutorial.

Kjell

2012-02-16 21:17, Curtis Gedak skrev:
In gtkmm-3.0, how does one create a combo box that has some entries that are not selectable or grayed out?

To help illustrate the problem I am using the tutorial code for a Combo Box from the following link: http://developer.gnome.org/gtkmm-tutorial/unstable/combobox-example-full.html.en

This code creates a combo box with three entries (depicted in text below).
In this example all three of the entries are selectable.

+---------------------+
|  1   Billy Bob      |
+---------------------+
| 2 Joey Jojo | <-- I would like this entry to be not selectable/grayed out.
+---------------------+
|  3   Rob McRoberts  |
+---------------------+

I would like to make one or more entries not selectable and grayed out.

From searching the Internet, the closest I have come is to learn that:

   The solution was to pack a Gtk::CellRendererText into the
   Gtk:ComboBox manually and use set_cell_data_func to set the
   "sensitive" property of the renderer to false...

Quote above is from the following link:
http://mail.gnome.org/archives/gtkmm-list/2007-June/msg00148.html

Unfortunately I have been unable to find sample code that demonstrates this ability.

Any help with this challenge would be greatly appreciated.

Sincerely,
Curtis Gedak
(Maintainer of GParted)

Attachment: ComboBox_not_selectable.tar.gz
Description: GNU Zip compressed data



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]