Re: [gtkmm] TreeView Design



Well, the book chapter doesn't have that extra level of complication, but it
doesn't address how to make a TreeView connect with underlying (non-gui)
models in an application.  (Unless I'm missing something).
Unless the primary store of data in an application is a ListStore I believe
you would still have to duplicate the data.  And so if a field is edited
then the callback would have to update both the ListStore and the underlying
model.   Normally I think an application should be written with data-types
that don't know anything much about the gui widgets that will be used to
display them, since it may have multiple different kinds of interfaces
layered on it.
How would you recommend setting up an editable view on data such as:

class Employee
{
public:
  accessors/mutators etc

private:
   int m_age;
  std::string m_name;
  etc;
};

std::vector<Employee> employees;

Would you extract out all the fields from the Employees and copy them into a
ListStore, or is that not necessary?

thanks for the fast response,
Dan


----- Original Message -----
From: "Murray Cumming" <murrayc usa net>
To: "Daniel Evison" <devison pacificit co nz>
Cc: "gtkmm mailing list" <gtkmm-list gnome org>
Sent: Thursday, July 18, 2002 7:51 PM
Subject: Re: [gtkmm] TreeView Design


> On Thu, 2002-07-18 at 08:43, Daniel Evison wrote:
> > Hi,
> > I'm trying to understand the design rational of TreeView, and have some
> > questions please:
> >
> > (The examples are from example_treeview_editable_cells.cc in
gtkmm-1.3.18)
> >
> > Looking at the way TreeView is used, it seems there are three levels:
> > 1. the underlying model - eg. CellItem_Product
>
> Some of the demos are coded bizarrely. This one is obviously very
> stupid. We needed to translate the C demost to C++ to prove that it
> could be done. But we now need to create sensible examples. C doesn't
> have those so we haven't translated them already.
>
> The book chapter doesn't have that extra level of complication:
> http://www.gtkmm.org/gtkmm2/tutorial/html/ch10.html
>
> > 2. another model - eg. Gtk::ListStore
> > 3. the view - eg. Gtk::TreeView
>
> [snip]
>
> --
> Murray Cumming
> murrayc usa net
> www.murrayc.com
>
>
>






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