From: Olivier Andrieu MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16482.47848.500208.447977 at akasha.ijm.jussieu.fr> Date: Thu, 25 Mar 2004 11:56:40 +0100 To: Christoph Bauer Cc: lablgtk at kaba.or.jp Subject: Re: Lablgtk under windows In-Reply-To: References: <000a01c41100$1959bc40$c64efea9 at Pc1> <20040324073520N.garrigue@kurims.kyoto-u.ac.jp> <16481.46955.27649.776507@karryall.dnsalias.org> Christoph Bauer [Wednesday 24 March 2004] : > > > BTW, I'm a bit disappointed about the complexity of the GTree > > > API. It is hard to create a simple list. > > > > It's not *that* hard. Anyway, that's not really LablGTK's fault, the > > GTK+ API is like this. > > > > In the latest snapshost there's a convenience function in GTree for > > creating "simple" list (ie a model with only one column). > > > > val store_of_list : > > 'a Gobject.data_conv -> 'a list -> > > list_store * 'a column > > > > let store_of_list conv data = > > let cols = new column_list in > > let column = cols#add conv in > > let store = list_store cols in > > List.iter > > (fun d -> > > let row = store#append () in > > store#set ~row ~column d) > > data ; > > store, column > > This is what I mean ;-) Yeah but now you don't have to write that code any more, it's in the library :) > Compare this code with the Tcl/Tk equivalent > > pack [listbox .lb -listvar l] Well you could easily write other convenience functions that do a bit more that the one above. > I have another tree related question. My application shows a list > of files on a remote machine. Some files are cached. It would be > nice when this files (= rows of my list) can be displayed in a > special color, e.g. with a green background color. With Tk I could > do a Add a boolean column in the model, indicating which of your files are cached. Then you connect this to a renderer property : let renderer = GTree.cell_renderer_text [ `CELL_BACKGROUND "green" ] in let view_column = GTree.view_column ~title:"..." ~renderer:(renderer, [ "text", file_name_column ; "cell-background-set", the_boolean_column ]) () in ... -- Olivier