changing Gtk::ComboBoxText text color
- From: <tony_silva alum mit edu>
- To: gtkmm-list gnome org, gtk-list gnome org
- Subject: changing Gtk::ComboBoxText text color
- Date: Thu, 28 Sep 2006 10:48:25 -0400 (EDT)
I've created a class StatusComboBoxText, derived from
Gtk::ComboBoxText, that is intended to change its base and text colors
depending on the currently selected value. I can already change the
base color in this manner (using Gtk::ComboBoxText::modify_base()) but
not its text color (using Gtk::ComboBoxText::modify_text() or any
other method). The simple test program attached below summarizes what
I've tried.
I'd greatly appreciate any clues on what I'm doing wrong. I read the
API manual, tutorials, and FAQs, searched for "ComboBox* and color*"
in "All mailing lists" at mail.gnome.org, and searched for "ComboBox
color" at bugzilla.gnome.org but am still stumped.
I'm using GTKmm 2.8.2 and GTK+ 2.8.9 on a Windows host/target. Since
this may have as much to do with GTK+ as GTKmm, I'm posting this
question to both lists.
TIA,
-- Tony
-----------------------------------------------------------------------------
// change Gtk::ComboBoxText base and text colors
#include <gtkmm.h>
int main(int argc, char** argv)
{
Gtk::Main kit(argc, argv);
Gdk::Color baseColor, textColor;
baseColor.parse("yellow");
textColor.parse("red");
Gtk::ComboBoxText comboBoxText;
comboBoxText.append_text("some text");
comboBoxText.set_active_text("some text");
// this changes the base color:
comboBoxText.modify_base(Gtk::STATE_NORMAL, baseColor);
// none of these change the text color (when
// done either before or after append_text()):
comboBoxText.modify_text(Gtk::STATE_NORMAL, textColor);
comboBoxText.modify_fg(Gtk::STATE_NORMAL, textColor);
comboBoxText.modify_bg(Gtk::STATE_NORMAL, textColor);
//comboBoxText.append_text("some text");
//comboBoxText.set_active_text("some text");
Gtk::Window window;
window.add(comboBoxText);
window.show_all();
kit.run(window);
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]