Changing TreeView Cell Renderers
- From: Bob Caryl <bob fis-cal com>
- To: GTKMM LIST <gtkmm-list gnome org>
- Subject: Changing TreeView Cell Renderers
- Date: Fri, 18 Mar 2005 15:53:03 -0600
Hello all,
I'm trying to use a treeview and I would like to have a boolean field in
the data to be rendered as a checkbox and be editable.
The code I'm using looks like this:
class ModelColumns : public Gtk::TreeModel::ColumnRecord
{
public:
ModelColumns()
{ add(m_disp);
add(m_check);
add(m_tag);
add(m_desg);
add(m_exec);
}
Gtk::TreeModelColumn<Glib::ustring> m_disp;
// column for menu display text
Gtk::TreeModelColumn<gboolean> m_check;
// column for check button
Gtk::TreeModelColumn<Glib::ustring> m_tag; //
column for menu xml tag
Gtk::TreeModelColumn<Glib::ustring> m_desg;
// column for menu designator text
Gtk::TreeModelColumn<Glib::ustring> m_exec;
// column for menu action text.
};
ModelColumns m_columns;
// columns for Gtk::ListStore object
Glib::RefPtr<Gtk::TreeStore> list; //
our listore object for the treeview
list = Gtk::TreeStore::create(m_columns);
tree->append_column_editable(" SEL ", m_columns.m_check);
tree->append_column(" Name ", m_columns.m_disp);
Gtk::CellRendererToggle *toggle = new Gtk::CellRendererToggle;
Gtk::TreeView::Column *pColumn = tree->get_column(0);
pColumn->clear();
pColumn->pack_start(*toggle);
The foregoing code does indeed place a checkbox type renderer in the
column cell, but it does not appropriately display the data, nor is it
editable. Oh yeah, that code does not appear inline like that in the
app.. just wanted to show all the declarations and definitions.
Any ideas on what I'm omitting or doing wrong here?
Thanks,
Bob Caryl
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]