Re: Row with different columns at runtime?
- From: Murray Cumming <murrayc murrayc com>
- To: Johannes Lorenz <johannes lorenz-privat net>
- Cc: Kristian Rietveld <kris imendio com>, gtk-list gnome org
- Subject: Re: Row with different columns at runtime?
- Date: Thu, 21 Feb 2008 13:47:43 +0100
On Mon, 2008-02-18 at 22:18 +0100, Johannes Lorenz wrote:
> Kristian Rietveld wrote:
> > You can try to use the "visible" property on the cell renderers. For
> > example, you would pack all cell renderers that can possibly appear in
> > the column and then set the visible properties from a CellDataFunc
> > accordingly.
> Where can I do this? In my example, I append a row. I can give the columns in
> this row different values, but where can I set visibility there?
>
> Below, some parts of my code are listed
>
> ---------------
> My Column Record:
> class OptColumns : public TreeModel::ColumnRecord
> {
> public:
> OptColumns()
> {
> add(col_value);
> add(col_textedit);
> add(col_checkbox);
> }
> // private:
> TreeModelColumn<string> col_value; // always there
>
> // variable:
> TreeModelColumn<string> col_textedit;
> TreeModelColumn<bool> col_checkbox;
> };
>
> ---------------
> The constructor code:
>
> Glib::RefPtr<Gtk::ListStore> OptTreeModel; // like Gtk::ListStore*
>
> // Fill the TreeView's model:
> TreeModel::Row row1 = *(OptTreeModel->append()); // 1st row
> row1[OptCols.col_value] = "links"; // I can set values here, but how to
> modify the widgets?
> row1[OptCols.col_checkbox] = false;
>
> TreeModel::Row row2 = *(OptTreeModel->append());
> row2[OptCols.col_value] = "links";
> row2[OptCols.col_textedit] = "test";
This code is all for the TreeModel, not for the TreeView, so it does not
seem relevant.
You probably want TreeView::set_cell_data_func():
http://www.gtkmm.org/docs/gtkmm-2.4/docs/reference/html/classGtk_1_1TreeViewColumn.html#765296845c9e9757ba405becbbc13d96
This is used in some of the gtkmm TreeView examples:
http://www.gtkmm.org/docs/gtkmm-2.4/docs/tutorial/html/sec-treeview-examples.html
By the way, you are more likely to get gtkmm-specific help on the
gtkmm-list mailing list.
--
murrayc murrayc com
www.murrayc.com
www.openismus.com
>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]