Re: [gtkmm] TreeView selection changes



Roger Leigh <roger whinlatter uklinux net> writes:

> Depending on whether there is a selected row in the TreeView, I have
> some [of the] buttons set insensitive.  In order to keep them in the
> correct state, I attached a handler to the signal_changed() signal
> of the Selection.  This works, but... when I call
> Gtk::ListStore::clear() to clear the list, the Selection doesn't
> emit a "changed" signal, even though its selection has been lost...
> What is the best way to deal with this?

I solved this my manually calling my Gtk::TreeSelection
"signal_changed" callback after clearing the list.  Is the "changed"
signal only emitted due to /user/ interaction with the TreeView?  If
so, is there any way of detecting changes to the Selection due to
changes in the underlying ListStore?

> Another issue is reloading the data in the list.  What is the best way
> to prevent the TreeView redrawing until I've finished populating the
> ListStore?  Can I disable signals somehow with gtkmm to achieve this?
> Is there a standard way of doing this?

I've solved this by removing all of the model columns from the
TreeView, and then setting the model to NULL.  After clearing and
re-populating the ListStore, I then set the model back to this and
re-add the model columns.

Is this is preferred way of doing this, or is there a better way?


Thanks,
Roger

-- 
Roger Leigh

                Printing on GNU/Linux?  http://gimp-print.sourceforge.net/
                GPG Public Key: 0x25BFB848.  Please sign and encrypt your mail.



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