GtkEntry +Fg Color +win32



Hi,

I have a problem trying to change the foreground color of an entry widget.
I'm using gtk2.2.x. Here's a code snippet of what I'm doing:

GtkWidget *entry;
GdkColor *gcolor;
entry = gtk_entry_new();
gcolor = get_gdk_color_by_name("Green"); // this returns a gdk color type
if (gcolor)
  gtk_widget_modify_fg(entry, GTK_STATE_NORMAL, gcolor);
...

I get a white background with black foreground, the default color settings.
Is this a bug? I've also tried setting the style with the following:

GtkStyle *style2;
style2->fg[GTK_STATE_NORMAL].red = gcolor->red;
style2->fg[GTK_STATE_NORMAL].green = gcolor->green;
style2->fg[GTK_STATE_NORMAL].blue = gcolor->blue;
gtk_widget_set_style(entry, style2);

Same results. If I set the style2->base[GTK_STATE_NORMAL].rgb, then I get a
green background with black text. Have I found a bug or do I need to try
something else?

Thanks
Bruce



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