Re: Gtk::CellRendererCombo how to

On 02/10/2017 06:17 AM, p_solntsev meta ua wrote:

Could you please provide a simple example how to use
Gtk::CellRendererCombo in Gtk::TreeView?

What I have for now is two column Gtk::TreeView. In first column (each
raw) I need ComboBox.

I have the following class for ComboModel. Is it necessary to have m_id

class ModelColumnsRender : public Gtk::TreeModelColumnRecord

     { add(m_name); }

   Gtk::TreeModelColumn<Glib::ustring> m_name;

Using m_columnsrender I can create a Gtk::ListTree model and populate it.

For TreeView itself, I also have the similar class as mentioned above:

class ModelColumns : public Gtk::TreeModelColumnRecord

     { add(m_name); add(m_amount) }

   Gtk::TreeModelColumn<Glib::ustring> m_name;
   Gtk::TreeModelColumn<Glib::ustring> m_amount;


I can also create a ListStore model using m_columns.

Now I do the following:
// Create a column
auto render = Gtk::manage(new Gtk::CellRenderCombo);
auto pCol = Gtk::manage(new Gtk::TreeViewColumn("Animals"));

pCol->pack_start(*render, true);

How can I add a model to my render? I tried

render->property_model() = refListStoreModelForCombo;

But no effect.

Where should I define the model for CellRenderCombo? inside of
ModelColumns class if so, how can I populate it?



Жіноча нижня білизна від Anabel Arto

gtkmm-list mailing list
gtkmm-list gnome org

Saying what we think gives us a wider conversational range than saying what we know.
   — Cullen Hightower

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