To: jocelyn.frechot at labri.u-bordeaux.fr Cc: lablgtk at kaba.or.jp Subject: Re: mailing list In-Reply-To: <3AB24BB2.47DEE112 at labri.u-bordeaux.fr> References: <3AB24BB2.47DEE112 at labri.u-bordeaux.fr> Mime-Version: 1.0 Content-Type: Text/Plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Message-Id: <20010317122620K.garrigue at kurims.kyoto-u.ac.jp> Date: Sat, 17 Mar 2001 12:26:20 +0900 From: Jacques Garrigue Lines: 66 From: Jocelyn Fr=E9chot > I'm working on a little application using lablgtk and I = > have a problem (of course :)). > I don't think using lablgtk after finishing this, so I = > don't know if it's a good idea to suscribe to the mailing = > list for only a couple of weeks. I didn't add you, but if you have questions, you can send them directly to lablgtk@kaba.or.jp, adding that you are not on the list. This way others can profit from the answer, and the message is archived.= > My problem is : > = > I would like to set the background color of (the label of) = > a tree_item object. And I don't know how... Changing the background color is always a pain with GTK, in fact I suppose you're not expected to do so, just to change the state, and have the background color for this state the same for the whole application. However, there are workarounds. Here is a modification to testgtk.ml, that will change the background color of the second element in the created tree. You just have to build the alignment and the label by hand= , and add an event_box to change the color. let rec create_subtree (item : GTree.tree_item) level nb_item_max recursion_level_max =3D if level =3D recursion_level_max then () else begin let item_subtree =3D GTree.tree () in for nb_item =3D 1 to nb_item_max do let item_new =3D GTree.tree_item ~packing:(item_subtree#insert ~po= s:0) ()in let ali =3D GBin.alignment ~x:0. ~xscale:0. ~packing:item_new#add = () in let label =3D GMisc.label ~packing:ali#add ~text:("item" ^ string_of_int level ^ "-" ^ string_of_int nb_i= tem) () in if nb_item =3D 2 then begin ali#remove label#coerce; let evbox =3D GBin.event_box ~packing:ali#add () in evbox#add label#coerce; let style =3D evbox#misc#style#copy in evbox#misc#set_style style; style#set_bg [`NORMAL, `NAME "green"]; end; create_subtree item_new (level + 1) nb_item_max recursion_level_ma= x; done; item # set_subtree item_subtree end ------------------------------------------------------------------------= --- Jacques Garrigue Kyoto University garrigue at kurims.kyoto-u.ac= .jp JG=