Re: [gtkmm] Editable CellRendererText with custom checks
- From: Murray Cumming <murrayc murrayc com>
- To: Roger Leigh <roger whinlatter uklinux net>
- Cc: gtkmm-list <gtkmm-list gnome org>
- Subject: Re: [gtkmm] Editable CellRendererText with custom checks
- Date: Sat, 28 Feb 2004 23:59:18 +0100
On Sat, 2004-02-28 at 22:10, Roger Leigh wrote:
> Reading from the Gtkmm tutorial (Chapter 8, editable cells), I was
> able to create an editable column using
> Gtk::TreeView::append_column_editable(). However, when I used plain
> append_column() to use my own custom checking callback, like this:
>
> m_treeview->set_model(m_tree_store);
> int view_column = m_treeview->append_column("Title", list_columns.m_col_editable);
> Gtk::CellRenderer *renderer = m_treeview->get_column_cell_renderer(view_column - 1);
> Gtk::CellRendererText *text_renderer = dynamic_cast<Gtk::CellRendererText *>(renderer);
> if (text_renderer)
> {
> text_renderer->signal_edited().connect
> ( SigC::slot(*this, &editable_treeview::on_edited) );
> }
>
> This doesn't do anything (the cell isn't editable) unless I add
>
> text_renderer->property_editable() = true;
>
> to the "if" block. This isn't mentioned in the tutorial, so I'm not
> sure if it's necessary. Am I missing something here, or is this
> required?
I don't understand. What were you trying to do? The book mentions that
you need to use append_column_editable() to get editable columns, so
it's natural to think that it won't be editable if you just use
append_column().
Note that it takes more than property_editable()=true to make the cell
really editable, as you can see in the implementation for
append_column_editable() - you need to respond to an appropriate signal
and put the new value into the model.
--
Murray Cumming
www.murrayc.com
murrayc murrayc com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]