Re: not able to change color of widget



Hi,

I've tried your code, it works for me. Did you try moving cursor out
of the button after you click it? If the cursor is still inside, the
button is in hovered state, not STATE_NORMAL.
If it still doesn't work, then what widget theme do you use? Maybe it
interferes with your actions (older versions of oxygen-gtk had this
problem, for example).

Regards,
Ruslan

On Thu, Oct 31, 2013 at 1:07 PM, Mahesh Chaudhari
<mahesh chaudhari ymail com> wrote:
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;
 }
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


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