Re: Treeview with editable checkboxes besides items?
- From: Jef Driesen <jefdriesen hotmail com>
- To: gtkmm-list gnome org
- Subject: Re: Treeview with editable checkboxes besides items?
- Date: Wed, 20 Jun 2007 08:56:19 +0200
Jef Driesen wrote:
Milosz Derezynski wrote:
That's not really how this works. Instead:
- You associate the renderer with an e.g. boolean column:
column->add_property (*cell, "active",
your_column_record_instance.bool_col);
- You connect to the toggled() signal: cell->signal_toggled().connect
(sigc::mem_fun (*this, &YourClass::callback_toggled))
- In the handler you do something like:
void
callback_toggled (Glib::ustring const& string_path)
{
TreeIter iter = your_model->get_iter (string_path);
(*iter)[your_column_instance.bool_col] = !bool
((*iter)[your_column_instance.bool_col]));
}
This approach works fine. Thanks!
There is one minor issue now. Clicking the name (not the checkbox!) also
toggles the checkbox. This is annoying if the user only wants to change
the selection. Is there a way to prevent this? Changing the name works
more intuitive: the first click changes the selection and editing starts
with another click.
To answer my own question: This effect can be obtained by changing the
mode for the CellRendererText:
renderer->property_mode() = Gtk::CELL_RENDERER_MODE_ACTIVATABLE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]