Hello all,
The first column of my TreeView displays two columns from my TreeStore model: a
bool/toggle and a string.
I would like the toggle to be editable, but not the adjacent string. I'm
struggling to implement this behavior.
Here's what I have at the moment:
----------------------
// Create a view column that contains a check-box and some text
Gtk::TreeView::Column* joint_column =
Gtk::manage(new Gtk::TreeView::Column("Fixture"));
joint_column->pack_start(fixtures_record_.get<1>(), false);
joint_column->pack_start(fixtures_record_.get<0>());
// Add it to the TreeView
fixtures_view_.append_column(*joint_column);
// Make it editable
Gtk::TreeViewColumn *col = fixtures_view_.get_column(0);
Gtk::CellRendererToggle *rend =
dynamic_cast<Gtk::CellRendererToggle *>(col->get_first_cell_renderer());
assert(rend);
rend->property_mode() = Gtk::CELL_RENDERER_MODE_EDITABLE;
col->add_attribute(rend->property_activatable(), fixtures_record_.get<6>());
----------------------
Here, fixtures_record_ is an object of type derived from
Gtk::TreeModel::ColumnRecord and each of its get<N>() member functions returns
a
Gtk::TreeModelColumn<T> for some appropriate T; get<0>() returns a
TreeModelColumn<string>, get<1>() a TreeModelColumn<bool>, and get<6>() a
TreeModelColumn<bool>.
All cells in column 6 are set to 'true'.
I believe the last two lines are in error, but I don't know how or why.
The book (http://www.gtkmm.org/docs/gtkmm-2.4/docs/tutorial/html/ch08s02.html)
says:
"You must set the cell's editable property to true, like so:
cell.property_editable() = true;"
but I can't work out what kind of object 'cell' is, here. CellRendererText has
a
property_editable() function, but CellRendererToggle hasn't and nor have any of
its bases.
Any help is very much appreciated!
Kind regards,
Edd
_______________________________________________
gtkmm-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gtkmm-list