[fxruby-users] Overriding default GUI colors

James Hibbard mr_nice66 at yahoo.com
Sun Jan 25 15:21:06 EST 2009


That worked perfectly :-)
Thank you very much for your help, and thank you everybody else for the replies.




________________________________
From: Lyle Johnson <lyle at lylejohnson.name>
To: fxruby-users at rubyforge.org
Sent: Sunday, 25 January, 2009 20:55:27
Subject: Re: [fxruby-users] Overriding default GUI colors



On Jan 24, 2009, at 6:26 AM, James Hibbard wrote:

I wrote a GUI using FXRuby under WinXP.
I then upgraded to Vista, installed Ruby (and thus by default FXRuby) and ran my GUI.
It was then that I noticed that the colours have gone weird. 
The main user interface is now white (the default colour that Vista uses), but all of the data targets and tables have remained beige (RGB 236, 233, 216).
Of course one can individualy declare a white background colour for each of these widgets, but then it looks garish if run on XP or Linux.
I'm looking for a setting I can apply to make the colour for the application uniform and overide the system default.
I already tried such things as app.backColour = FXRGB(236, 233, 216).
If you didn't build FOX from source code, you probably don't have the FOX Control Panel application installed, and so you'll need to change these default colors in your application code.

The trick, however, is to change the color values after the FXApp's init() method gets called, but before you create any of your application's widgets:

app = FXApp.new
app.init(ARGV)
#

# Change default colors here, e.g.

# app.backColor = FXRGB(236, 233, 216)

#

main_window = FXMainWindow.new(app, ...)

app.create
app.run

When you construct a widget (like an FXMainWindow), it copies the colors from FXApp, and so if you haven't changed them by that point you have to go make changes on a widget-by-widget basis (which is a pain). Also, note that in many FXRuby applications you won't see FXApp#init called explicitly, because it gets called automatically for you if you don't need it.

Hope this helps,

Lyle


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/fxruby-users/attachments/20090125/6cf521e2/attachment-0001.html>


More information about the fxruby-users mailing list