[gtkmm] Editable CellRendererText with custom checks



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?


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]