[Gtk-sharp-list] Change background of widget using theme colors
Chris Howie
cdhowie at gmail.com
Mon Aug 4 08:43:48 EDT 2008
On Sun, Aug 3, 2008 at 2:01 AM, Mark A. Nicolosi
<mark.a.nicolosi at gmail.com> wrote:
> I'm trying to make an application have a bar similar to the one in Nautilus
> when you visit the trash location. I've got it to work by changing the
> background in OnRealized() of my widget:
>
> protected override void OnRealized ()
> {
> base.ModifyBg (StateType.Normal, base.Style.Background
> (StateType.Selected));
> base.OnRealized ();
> }
>
> Now the problem is, I want it to change when the theme changes like the rest
> of Gnome. I can't call base.ModifyBg() in OnStyleSet(), it crashes the
> program (I think Gtk+ gets in an infinite loop).
>
> Anyone have any ideas?
You should be calling base.OnRealized() first. Unless you are trying
to prevent the parent class from doing what it needs to do on
realization for some reason.
I'm not sure this will fix the problem you have described but it is a
glaring error to omit this call.
--
Chris Howie
http://www.chrishowie.com
http://en.wikipedia.org/wiki/User:Crazycomputers
More information about the Gtk-sharp-list
mailing list