Re: [gtkmm] Question to GTKmm widgets (can I do this with GTKmm?)



"Andreas B. Thun" <abt gmx de> writes:

> class ModelColumns : public Gtk::TreeModelColumnRecord
> {
> public:
>    Gtk::TreeModelColumn<Glib::ustring> col_1;
>    Gtk::TreeModelColumn<Glib::ustring> col_2;
> 	
>    ModelColumns()
>    {
> 	add (col_1);
> 	add (col_2);
>    }
> };
>
> The problem I am facing now is that my column data is dynamic.
> (It does not change while the program is running, though).

I've never tried this, but can't you just use an array? For example:

  public:
    std::vector<Gtk::TreeModelColumn<Glib::ustring> > cols;
 	
    ModelColumns(int no)
    {
      for (int i = 0; i < no; ++i) {
        cols.push_back(Gtk::TreeModelColumn<Glib::ustring>());
 	add(cols.back());
      }
    }

I'm not sure whether it works, though. The interface for the treeview
classes is very confusing.

-- 
Ole Laursen
http://www.cs.auc.dk/~olau/



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