[gtkmm] Label background color



I am trying to change the background color of a label.

I have these two pieces of code.  They change the font color properly, but the background color does not change.  I don't understand why.  Can anyone help me with this?

void wdMainDisplay::on_muCopyright_activate()
{
Gdk::Color b( "blue" );
Gdk::Color g( "green" );
Gdk::Color r( "red" );
Gtk::StateType state = wdMainDisplay::lbDateDisplay->get_state();
wdMainDisplay::lbDateDisplay->modify_fg(state, r );
wdMainDisplay::lbDateDisplay->modify_bg(state, b );
}

void wdMainDisplay::on_muDebug_activate()
{
Gdk::Color b( "blue" );
Gdk::Color g( "green" );
Gdk::Color r( "red" );
Gtk::StateType state = wdMainDisplay::lbDateDisplay->get_state();
Glib::RefPtr<Gtk::RcStyle> style = wdMainDisplay::lbDateDisplay->get_modifier_style();
style->set_bg( state, r);
style->set_fg( state, g);
wdMainDisplay::lbDateDisplay->modify_style(style);
}

I also tried set_state() but I couldn't get it to run correctly.

Thanks for any help given!!

Bill Dewey




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