tags:

views:

625

answers:

1

Trying to change background/foreground color....Using Gtk+ and C.

  GdkColor color;
  gdk_color_parse( "#0080FF", &color );
  gtk_widget_modify_fg( GTK_WIDGET(button), GTK_STATE_SELECTED, &color );
  gtk_widget_modify_fg( GTK_WIDGET(button), GTK_STATE_NORMAL, &color );

I am using above functionality but it is not giving any results.

I am looking for something asked in this question(But in C):
http://stackoverflow.com/questions/1241020/gtk-create-a-colored-regular-button

how to Change Style of Button using button Style? Can anybody provide some examples?

+2  A: 

Picture of Red GtkButton

GdkColor color;

gdk_color_parse ("red", &color);

gtk_widget_modify_bg ( GTK_WIDGET(button), GTK_STATE_NORMAL, &color);

Notice that we are modifying bg instead of fg.

DoR
I have set border Relief to NONE... So it is not displaying the BG/FG color... hot to set BG/FG color when Border Relief is None??
PP
I do not think that is possible. When the button's border relief is set to none, it acts like a label as in it is "transparent", it has the same bg color as its parent container.
DoR