To: moi at nraynaud.com Cc: lablgtk at kaba.or.jp Subject: Re: Style and color In-Reply-To: <20020614014717.25781.qmail at web13906.mail.yahoo.com> References: <20020614014717.25781.qmail at web13906.mail.yahoo.com> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-Id: <20020620123604Q.garrigue at kurims.kyoto-u.ac.jp> Date: Thu, 20 Jun 2002 12:36:04 +0900 From: Jacques Garrigue Lines: 42 From: Nicolas Raynaud > I use the widows version of lablgtk > > As stated in the ML archive, it is not possible to change a > foreground color of a Style directly. Yes, this was lacking. I don't understand very well how you're supposed to use GtkStyle, so I avoided interfacing to it until now, but I added it reading your mail (snapshot 2002-06-20). Apparently one should just get direct access to most of the fields, and remember the basic procedure: let style = w#misc#style#copy in style#set_fg [`NORMAL, `NAME "red"]; w#misc#set_style style Note also that you should be careful about what widget you are modifying. If this is a button, the text is inside a label, so this should be let label = List.hd button#children in label#misc#set_style style Reciprocally, since a label has no window, setting its background will have no effect. > I have 'grep'ed a few in the sources and I noticed the absence of > 'gtk_rc_parse()' > and that 'gtk_rc_add_default_file()' is wrapped but not connected. Is using gtk_rc_parse standard? I had a feeling it was an internal function. I've added GtkMain.Rc.add_default_file. I join a patch for this last one, as you can recompile lablgtk.cma alone, if you cannot recompile the C code. > I wonder how I can change a foreground color in my application ? With the new snapshot, you can. Otherwise, the only solution I see is writing it in your main .gtkrc... --------------------------------------------------------------------------- Jacques Garrigue Kyoto University garrigue at kurims.kyoto-u.ac.jp JG