TreeModel Dynamic How



Hi, I hope You can Understand my inglish, im not good al all for writin
but....
This is my question, how can i implement a Gtk::ListStore Dynamically;
for example:
I have a database and y want to draw the tables with a general method on
an TreeView.
Y know that y have to create a TreeModelColumnRecord, but how i can
create dynamically them. This is create dynamically columns and add them
to the TreeModelColumnRecord, for then i create the ListStore, and how i
point to thems (TreeModelColumns i create dinamically) for show thems on
the TreeView.

something like this:

create_list_view(Glib::RefPtr<Gnome::Gda::DataModel> query_result)
{
  for(glong i=0; i<query_result->get_n_columns(); i++)
  {
    type_column = new Gtk::TreeModelColumn<type>;
    model_columns_record.add(type_column);
  }
  model_columns = Gtk::TreeStore::create(model_columns_record);
  for(glong i=0; i<query_result->get_n_rows(); i++)
  {
     for(glong j=0; j<query_result->get_n_columns(); j++)
     {
       row->set_value(j, query_result->get_value_at(j,i).to_type());
     }
  }
  tree_view->set_model(model_columns);
  for(glong i=0; i<query_result->get_n_columns(); i++)
  {         treeview->append_column_editable(
query_result->get_column_title(i),
                                                              (How can i
point tho the columns of the model_columns_record for add thems to the
view)
                                                             ); 


  }
}

thanks;



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