[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Bordered Gtk Label

Martin DeMello

7/6/2005 1:39:00 PM

How do I draw a rectangular border around a Gtk Label? Also, is there
any way to set the background colour on an individual widget?

martin
1 Answer

Martin DeMello

7/7/2005 11:25:00 AM

0

Martin DeMello <martindemello@yahoo.com> wrote:
> How do I draw a rectangular border around a Gtk Label? Also, is there
> any way to set the background colour on an individual widget?

FWIW the answers are

1. Enclose it in a Gtk::Frame (at least, that's the best I could come up
with)

2. Gtk::Widget#modify_bg(state, colour)

(From Geoff Youngs on the ruby-gnome2 mailing list:
ISTR that this only works for widgets which actually have a background
window, otherwise you'll need to wrap the widget in a Gtk::EventBox,
which does.

e.g.
col = Gdk::Color.parse("red")
label = Gtk::Label.new("Warning")
eb = Gtk::EventBox.new()
eb.add(label)
eb.modify_bg(Gtk::STATE_NORMAL, col)
)

martin