why i can't set background of widget?
- From: gxw <szg309 sina com>
- To: gtk-app-devel <gtk-app-devel-list gnome org>
- Subject: why i can't set background of widget?
- Date: Wed, 11 Feb 2004 11:39:06 +0800
After run the following simple code,the button background is black,and can't see "Hello World",who can tell
me the reason?
Thank you!
#include <gtk/gtk.h>
int main( int argc,char *argv[] )
{
GtkWidget *window;
GtkWidget *button;
GtkStyle *style;
gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
button = gtk_button_new_with_label ("Hello World");
style=gtk_style_new();
style->bg[GTK_STATE_NORMAL].red=0;
style->bg[GTK_STATE_NORMAL].green=0;
style->bg[GTK_STATE_NORMAL].blue=255;
gtk_widget_set_style(button,style);
gtk_container_add (GTK_CONTAINER (window), button);
gtk_widget_show (button);
gtk_widget_show (window);
gtk_main ();
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]