To: Francois.Pottier at inria.fr Cc: lablgtk at kaba.or.jp Subject: Re: Misc questions In-Reply-To: <20030921180318.A7068 at pauillac.inria.fr> References: <20030921111027.A12292 at pauillac.inria.fr> <87llsifhlq.dlv@wanadoo.fr> <20030921180318.A7068@pauillac.inria.fr> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-Id: <20030922101819Y.garrigue at kurims.kyoto-u.ac.jp> Date: Mon, 22 Sep 2003 10:18:19 +0900 From: Jacques Garrigue Lines: 61 From: Francois Pottier > Of course, as I write this answer to your question, I realize that > this means that [tree_path] objects are brittle, but [tree_iter] > objects perhaps aren't. So the right thing to do may be to write > instead: A tree path is just equivalent to a numerical description of a path. So it is utterly unable to handle situations where you suppress a path before it, for the evident reason. Note that your path might still return something, but probably wrong. > let fold_selected_elements accu f = > List.fold_left (fun accu row -> > let element = ftu8 (model#get ~row ~column:element_column) in > f accu row element > ) accu (List.map model#get_iter (view#selection#get_selected_rows)) > in > > I have tried this, and indeed it appears to work. Sorry for the > trouble! IIRC, tree iters are invalidated by some operations, but not all. So I'm afraid that if this works, you might only have been lucky. The answer is that row references are (at least in theory) needed for this example, but not properly wrapped yet as we did not need them yet. > Still, I wonder whether there is sometimes a need for the functions in > module [GtkTree.RowReference] and if so, how to use them? More > generally, how do I distinguish low-level functions that I'm not > supposed to use from high-level functions? The general rule seems to > be that Gtk* modules are not for general use, while G* modules are, > but is that rule always valid? This is the idea. If you need some functionality in the Gtk modules, you may access it by using some casts (but no magic, please) GtkTree.RowReference.create (model#as_model :> Gtk.tree_model Gtk.obj) In some case you may even have to use (safe) downcasts, like GtkTree.TreeModel.cast (but in the above case an upcast is enough) However, if you encounter such a functionality, please report it to this list, and we will try to wrap it properly at the object level, taking into account typing and semantics problems. Same thing for Window.maximize, you can use it directly (it is available as GtkWindow.Window.maximize), but we will add it to the window class in the next release. (By the way, the absence of GtkProps.cmi is intentional: all the functionality is re-exported in proper modules, and the structure of GtkProps will probably change in the future) The situation is that there are so many functions in GTK that we have not yet assessed which are useful and which are not. An easy(?) solution would be to put everything in, but then you end up with incoherences, like why would you want to maximize a dialog? Cheers, Jacques