Message-ID: <42282501.5040805 at tin.it> Date: Fri, 04 Mar 2005 10:06:09 +0100 From: Stalkern 2 MIME-Version: 1.0 To: Richard Jones , lablgtk at kaba.or.jp Subject: Re: tree view models written in ocaml References: <20050303234255.GA25179 at furbychan.cocan.org> In-Reply-To: <20050303234255.GA25179 at furbychan.cocan.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Richard Jones wrote: > I too am having problems with GtkTreeView. > > I have quite a complex hierarchical model already. In particular each > node in the model can contain a bunch of arbitrary extra data > structures which I don't want to be displayed as columns. > Don't worry, displaying data now requires explicit will ;-) > Is it better to write my own tree model? (And if so, where on earth > do I start? I have no idea how to go about this.) Copy and modify a simple model and write a function feeding it from your data tree (you can walk vertically through your data tree and append leaves to the model when you meet them) > > Or is it better, as was suggested on one of the Gtk lists, to use a > Gobject.Data.pointer or Gobject.Data.boxed to "hang" my extra > structures on to a row, and just use the ordinary GtkTreeModel? (I'm > not exactly sure how to do this one either ...) That's too much overhaul I think. What I'd do is use the data tree for data, and when you want to show some data, synchronize the tree model with those data; when the user modifies data in the tree view, synchronize the tree model and also the data tree. If you are not sure that you can synchronize everything without getting into a mess, focus on the data tree and if necessary summarize the passages [change from tree view] -> [change in tree model] [change from tree view] -> [change in data tree] into [change from tree view] -> [change in data tree] -> [change in tree model] Personally, I had so far three cases where I had to replace my GTrees, and the solution was radically different in every case... Hope this helps! Ernesto