Re: Change button color in button-press-event
- From: Robert Pearce <rob bdt-home demon co uk>
- To: gtk-list gnome org
- Subject: Re: Change button color in button-press-event
- Date: Sat, 24 Apr 2010 18:37:23 +0100
Hi gtk digosp com,
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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]