Re: Chage colour on a Gtk::Frame



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


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