Re: can't change color of label
- From: oded <o sadglad com>
- To: gtkmm-list gnome org
- Subject: Re: can't change color of label
- Date: Tue, 29 Aug 2006 11:51:00 +0200
Ok, made a mistake in my post:
If I initilize the color like this:
Gdk::Color* color = new Gdk::Color("green");
Then it does it work, contrary to what I said.
But If I use this:
Gdk::Color* color = new Gdk::Color();
color->set_rgb(0,220,0);
then the label will stay black.
And adding these lines to allocate the color does not help.
Glib::RefPtr<Gdk::Colormap> colorMap=Gdk::Colormap::get_system();
colorMap->alloc_color(*color, true, true);
Thanks,
Oded.
----- Original Message -----
From: "oded" <o sadglad com>
To: <gtkmm-list gnome org>
Sent: Tuesday, August 29, 2006 11:34 AM
Subject: can't change color of label
Hello!
I am new to GTK, and GTKmm.
I use gtkmm 2.4 on windows-xp.
I'm trying to change the color of a label.
I managed to do it using the C interface using the code:
GtkLabel* gtkLabel = label->gobj();
GdkColor color;
gdk_color_parse ("red", &color);
gtk_widget_modify_fg ((GtkWidget*)gtkLabel, GTK_STATE_NORMAL, &color);
but when I try to use the c++ interface the label remains black, using
this
code:
Gdk::Color* color = new Gdk::Color("red");
Glib::RefPtr<Gdk::Colormap> colorMap=Gdk::Colormap::get_system();
colorMap->alloc_color(*color, true, true);
label->modify_fg(Gtk::STATE_NORMAL, color);
I tried also to inilize the color using set_rgb, or without allocating it,
or to use modify_text, and modify_base, or to create a style and use
modify_style, or use label->set_state(Gtk::STATE_NORMAL); or use
label->set_use_markup(false);
but to no avail, it still remains black.
Thanks,
Oded.
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]