dml12
asked on
ruby gtk3 entry problem
I have a Ruby application that I have migrated to gtk3. Most things are working but changing the background color does not work for Entry's . I It works fine for buttons. The commands are of the form:
color = Gdk::RGBA.parse("lightblue 1")
widget.override_background _color(0, color)
gtk3 wants RGBA colors. Another report of this problem said they only got it working using css . This requires using style & providers. Are there any examples of how to do this in Ruby.
color = Gdk::RGBA.parse("lightblue
widget.override_background
gtk3 wants RGBA colors. Another report of this problem said they only got it working using css . This requires using style & providers. Are there any examples of how to do this in Ruby.
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
ASKER
provider1 = Gtk::CssProvider.new
provider1.load :data => '#numeric_controll1 {
color: green;
background-color: black;
border-style: solid;
border-width: 16px;
border-color: red;
}'
styleContext = Gtk::StyleContext.new
styleContext.add_provider provider1, GLib::MAXUINT
apply_css(self, provider1)
def apply_css(widget, provider)
widget.style_context.add_p
if widget.is_a?(Gtk::Containe
widget.each_all do |child|
apply_css(child, provider)
end
end
end