not able to change color of widget



what am I doing wrong in Following Code : 

GtkWidget *button1;
 void click_button1(GtkWidget *widget, gpointer data)
 {
   printf("I am in click_button\n");                    // able to print this 
   GdkColor color;
   color.red = 27000;
   color.green = 30325;
   color.blue = 34181;
   gtk_widget_modify_bg(GTK_WIDGET(widget), GTK_STATE_NORMAL, &color);
//gtk_widget_modify_fg(GTK_WIDGET(widget), GTK_STATE_NORMAL, &color);
 }
 
 
 some_callback_func()
 {  ....
      gtk_button_clicked(GTK_BUTTON(button1));
    ..... }

 
 
 
int main(int argc, char** argv)
{
  gtk_init(&argc,&argv);      
    button1 = gtk_button_new_with_label ("button1");
     g_signal_connect(G_OBJECT(button1), "clicked", G_CALLBACK(click_button1), NULL);      
     gtk_widget_show_all (window);
     gtk_main();
     return 0;
 }


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