Re: Chage colour on a Gtk::Frame



Nickolai Dobrynin wrote:
Steven,

Since Gtk::Frame derives from Gtk::Bin, it doesn't have an ability to receive X events (of which setting the bg color is a special case) on its own. To see this, look at the gtk_bin_init(..) function. The following line is of interest: GTK_WIDGET_SET_FLAGS(bin, GTK_NO_WINDOW).

Thus, the only option you have is to create an X event processing widget by hand and put your Gtk::Frame
inside that widget, e.g.

Gtk::EventBox eventBox;
eventBox.add(yourGtkFrame);
eventBox.modify_bg(Gtk::STATE_NORMAL, color);

I do agree this is confusing as hell because you would normally expect the widget to have its own window
unless it's a descendant of Gtk::Misc.


Regards,

Nickolai
Thank you both for your answers.

It's really helpful to know this, as I just assumed [incorrectly] that any widget could receive colour orders, as I didn't think of them as X events. As it happens, I have been using an EventBox to capture mouse clicks for the Frame, so it's all working. =]

Cheers.

~ Steven



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]