Re: Attach invisible data to a TreeRow?



Matthias,

Easy.  Just don't add the column of your model to the view.

//The model object.
class EventColumns : public Gtk::TreeModel::ColumnRecord

{
   public:

   EventColumns()
   {
       add( id ) ;
       add( event ) ;
       add( event_name ) ;
       add( x ) ;
       add( y ) ;
       add( lapse ) ;
       add( frame ) ;
       add( extra_parents ) ;
   }

   Gtk::TreeModelColumn<int>           id ;
   Gtk::TreeModelColumn<int>           event ;
   Gtk::TreeModelColumn<Glib::ustring> event_name ;
   Gtk::TreeModelColumn<int>           x ;
   Gtk::TreeModelColumn<int>           y ;
   Gtk::TreeModelColumn<float>         lapse ;
   Gtk::TreeModelColumn<int>           frame ;
   Gtk::TreeModelColumn< vector<int> > extra_parents ;
} ;


//Attach the model to the view
_event_store = Gtk::TreeStore::create( _event_columns ) ;
_cell_events_tree->set_model( _event_store ) ;
_cell_events_tree->append_column( "ID", _event_columns.id ) ;
_cell_events_tree->append_column( "Event", _event_columns.event_name ) ;
_cell_events_tree->append_column( "Frame", _event_columns.frame ) ;


I'm using a TreeStore here, but the idea is exactly the same for ListStore IIRC.

Hope that helps.

Paul

Matthias Kaeppler wrote:

Hello,

I was wondering if it's possible to attach additional, invisible data to a TreeRow in a ListStore. I'm not talking about any actual values which are visible to the user, but some form of meta data which can be used to relate the row to certain other data in an efficient way (e.g. through a pointer). I need this kind of funtionality to map filenames in display format to actual filenames on the disk, in order to avoid having two containers of filenames, one holding the actual names, the other the names in displayable format (this would introduce a lot of redundancy).

I thought about deriving from TreeRow and add a new data field, in fact a pointer to the real filename which matches the displayed name in the row, but that doesn't help because ListStore creates the rows for me using append().

Any ideas?

Thanks,
Matthias

_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list





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