Re: Editable toggle when multiple model cols in view col

Edd Dawson wrote:

[ 8< --- snip ]

> TestWindow::TestWindow() :
>     record_def_(),
>     layout_(),
>     upper_model_(Gtk::ListStore::create(record_def_)),
>     lower_model_(Gtk::ListStore::create(record_def_)),
>     upper_view_(upper_model_),
>     lower_view_(lower_model_)
> {
>     // Create a single column that contains a check-box and some text.
>     //Add it to the upper view
>     Gtk::TreeView::Column* joint_column =
>         Gtk::manage(new Gtk::TreeView::Column("Joint column"));
>     joint_column->pack_start(record_def_.enabled, false);
>     joint_column->pack_start(record_def_.description);
>     upper_view_.append_column(*joint_column);
>     // Make the bool/check-box part of the upper view's column editable and
>     //connect a slot to catch any edits
>     Gtk::TreeViewColumn *col = upper_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; // ***

Crisis averted :)

The last line above is my problem. Removing it allows the signal to fire. I'm not sure why, though. Also the timing of the signal differs for the upper and lower views in that the signal for the upper view fires before the toggle is actually performed and so one must perform the (vetted) assignment to the model column in the slot callback. The slot for the lower view, however, is called only once the toggling and model-edit has already been done.

Is there a reason for this difference?

Kind regards,


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