Re: Button release makes button look different, how do I stop this?




Hi Folks

I have created some buttons and change the colour of them with the
following code

[snip]
 color.red   = BUTTON_GREY_RED;
  color.green = BUTTON_GREY_GREEN;
  color.blue  = BUTTON_GREY_BLUE;

  gdk_color_alloc(gdk_colormap_get_system(), &color);
  new_style                =
gtk_style_copy(gtk_widget_get_default_style());
  new_style->bg[GTK_STATE_NORMAL]   = color;
  new_style->bg[GTK_STATE_PRELIGHT] = color;
  new_style->bg[GTK_STATE_ACTIVE]   = color;

  gtk_widget_set_style(GTK_WIDGET(fly1Button), new_style);
  gtk_widget_set_style(GTK_WIDGET(fly2Button), new_style);
  gtk_widget_set_style(GTK_WIDGET(ret1Button), new_style);
  gtk_widget_set_style(GTK_WIDGET(ret2Button), new_style);
  gtk_widget_set_style(GTK_WIDGET(water2Button), new_style);
  gtk_widget_set_style(GTK_WIDGET(water2Button), new_style);
[snip]

When I run the app and release a button after I have pushed it that
particular button(pressed button) looks a little different from the
other buttons(other buttons).  The bottom and right edges are darker on
(pressed button)  than on (other buttons).  How can I make it so when
the button is released (pressed button) looks the same as (other
buttons)


I think the dark edge you are referring to is the
normal focus indication that will stay with clicked
buttons until you move the focus to another widget.
I don't think this is related to your alternate
color scheme.

If you wish to remove the focus indication, one way
is to unset the focus every time you receive it,
although this may have other consequences that are
undesirable for your application.

        gtk_signal_connect (GTK_OBJECT (button), "draw_focus",
                            GTK_SIGNAL_FUNC (my_draw_focus), NULL);
:
:
void my_draw_focus (GtkWidget *widget, gpointer data)
{
        GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS);
        gtk_widget_queue_draw (widget);
}


- Dermot

Dermot McCluskey - Sun Microsystems, Ireland - Desktop Test






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