Hi, you need to allocate the colors via the widget's colormap, IIRC.
Cheers, Martin 2008/3/19, LIU Chun Hung <[EMAIL PROTECTED]>: > Hi, > > I want to create three buttons with different colors. But three buttons > are with the same colors at the final. What's wrong? Anybody help? My > program code is as below: > > GtkWidget *bn1, *bn2, *bn3; > GdkColor red_color, green_color, blue_color; > GtkStyle *bn1_style, *bn2_style, *bn3_style; > > bn1 = gtk_button_new(); > bn2 = gtk_button_new(); > bn3 = gtk_button_new(); > > red_color.red = 65535; > red_color.green = 0; > red_color.blue = 0; > green_color.red = 0; > green_color.green = 65535; > green_color.blue = 0; > blue_color.red = 0; > blue_color.green = 0; > blue_color.blue = 65535; > > bn1_style = gtk_widget_get_style(bn1); > bn1_style->bg[GTK_STATE_NORMAL] = red_color; > gtk_widget_set_style(bn1, bn1_style); > bn2_style = gtk_widget_get_style(bn2); > bn2_style->bg[GTK_STATE_NORMAL] = green_color; > gtk_widget_set_style(bn2, bn2_style); > bn3_style = gtk_widget_get_style(bn3); > bn3_style->bg[GTK_STATE_NORMAL] = blue_color; > gtk_widget_set_style(bn3, bn3_style); > > Three buttons are in blue at the final. > > Regards, > Hung > > _______________________________________________ > maemo-developers mailing list > [email protected] > https://lists.maemo.org/mailman/listinfo/maemo-developers > _______________________________________________ maemo-developers mailing list [email protected] https://lists.maemo.org/mailman/listinfo/maemo-developers
