Delivered-To: lablgtk at yquem.inria.fr Message-ID: <18347849.post at talk.nabble.com> Date: Tue, 8 Jul 2008 13:03:37 -0700 (PDT) From: Eddy2 To: lablgtk at yquem.inria.fr Subject: Re: [Lablgtk] Gdk.color GTree.column ? In-Reply-To: <4873715E.7080207 at irisa.fr> MIME-Version: 1.0 Content-Transfer-Encoding: 7bit References: <4873715E.7080207 at irisa.fr> Content-Type: text/plain; charset=us-ascii Content-Length: 1596 Hi, If you *really* want to use Gdk.color I cannot help you. But if you just want to add colors to your treeview, then I have a solution : you may use a #RRGGBB string in conjunction with "background" property. Here is a little working example : ----- let cols = new GTree.column_list let text = cols#add Gobject.Data.string let bg_color = cols#add Gobject.Data.string (* We use the well-known string type *) let model = GTree.list_store cols let cell = GTree.cell_renderer_text [`WEIGHT `BOLD; `FOREGROUND "white"] let vcol = let vcol = GTree.view_column ~title:"Exemple" () in vcol#pack cell; vcol#add_attribute cell "text" text; vcol#add_attribute cell "background" bg_color; vcol let window = GWindow.window ~title:"Color Demo" ~position:`CENTER ~width:200 ~height:550 () let view = let view = GTree.view ~model ~packing:window#add () in view#append_column vcol; view let to_string r g b = Printf.sprintf "#%02x%02x%02x" r g b let _ = window#connect#destroy GMain.quit; for i = 0 to 20 do let j = 5 * i in let row = model#append () in model#set ~row ~column:text (Printf.sprintf "Blue %i%%" j); model#set ~row ~column:bg_color (to_string 0 0 j) done; window#show (); GMain.main () ----- Hope this helps, Eddy -- View this message in context: http://www.nabble.com/Gdk.color-GTree.column---tp18339824p18347849.html Sent from the Lablgtk - France mailing list archive at Nabble.com. _______________________________________________ Lablgtk mailing list Lablgtk@yquem.inria.fr http://yquem.inria.fr/cgi-bin/mailman/listinfo/lablgtk