Re: Change button color in button-press-event

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

 



Hi gtk@xxxxxxxxxx,

On Sat, 24 Apr 2010 09:49:37 -0400 you wrote:
> 
> When a button is pressed, I want to change its color to blue, and when  
> it is released to restore its original color.
>
When you say "pressed", you mean active? I think you need to look up the documentation on styles and themes.
 
> The code I use is shown below.
> I do get BUTTON PRESS and BUTTON RELEASE messages, but the button  
> color does not change.

<snip>
>      gtk_widget_modify_bg(widget, GTK_STATE_PRELIGHT, &color);
>      gtk_widget_modify_bg(widget, GTK_STATE_NORMAL, &color);

So if you want to affect the appearance of the button while "pressed", which is called "ACTIVE", then why are you setting its colour in the "NORMAL" and "PRELIGHT" states?

If I understand your intentions right, I don't think you need signal handlers or call-backs. Just set the widget's "ACTIVE" background colour and GTK will do the rest.


Rob
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux