Gtk::CellRendererCombo how to
- From: p_solntsev meta ua
- To: gtkmm-list gnome org
- Subject: Gtk::CellRendererCombo how to
- Date: Fri, 10 Feb 2017 16:17:49 +0200 (EEST)
Hi,
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
member?
class ModelColumnsRender : public Gtk::TreeModelColumnRecord
{
public:
ModelColumnsRender()
{ add(m_name); }
Gtk::TreeModelColumn<Glib::ustring> m_name;
}m_columnsrender;
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
{
public:
ModelColumns()
{ add(m_name); add(m_amount) }
Gtk::TreeModelColumn<Glib::ustring> m_name;
Gtk::TreeModelColumn<Glib::ustring> m_amount;
}m_columns;
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);
treeview->append_column(*pCol);
treeview->append_column("Amount",m_columns.m_amount);
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?
Thanks.
-Pavlo
______________________________
Жіноча нижня білизна від Anabel Arto
http://go.meta.ua/anabel_lingery_ua
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]