From: Nathaniel Talbott Date: 2000-12-13T21:43:53+09:00 Subject: [ruby-talk:7142] Re: Gtk widget color > >Thanks for the help, but unfortunately, it didn't work. > > Did you try yashi's code sample verbatim? Ignore the man who's red in the face :) OK, I tried yashi's code verbatim, and it worked. So, I modified it slightly to include what's not working for me: require 'gtk' window = Gtk::Window.new # create two Style for two different color. # you can't modify style's color in signal handlers red = Gtk::Style.new blue = Gtk::Style.new # make red be red, blue be blue # I changed this to be STATE_PRELIGHT instead of STATE_NORMAL, # which is the state corresponding to the progress bar's foreground red.set_bg(Gtk::STATE_PRELIGHT, 65535, 0, 0) blue.set_bg(Gtk::STATE_PRELIGHT, 0, 0, 65535) # Add a half full progress bar, too button = Gtk::Button.new 'Hello, World' progressBar = Gtk::ProgressBar.new progressBar.configure(5, 0, 10) # Start 'em both as red (this works) button.set_style red progressBar.set_style red bool = false button.signal_connect('clicked') do if bool progressBar.set_style red button.set_style red bool = false else progressBar.set_style blue button.set_style blue bool = true end # don't forget to redraw so that the change show up button.queue_draw progressBar.queue_draw end window.signal_connect('delete-event') do Gtk.main_quit end window.border_width = 10 vbox = Gtk::VBox.new(false, 0) vbox.pack_start(progressBar, false, false, 0) vbox.pack_start(button, true, true, 0) window.add vbox window.show_all Gtk.main This works... for the button. The progress bar never changes from its initial state of red, while the button toggles merrily back and forth. So, is it a bug in Gtk? A bug in Ruby/Gtk? Does it work on Linux (I'm on W2K)? I've searched around a bit looking for someone else having the same trouble, and I can't seem to find anything. Ideas? Nathaniel <:((>< + - - + - - | RoleModel Software, Inc. & | EQUIP VI | The XP Software Studio(TM) |