Re: Turn off highlight




ALT2376@ritvax.isc.rit.edu writes:

> Hello,
> 	Can i turn the highlight(select) off of the button widget?. I can't
> make it INSENSITIVE, because then the label's gray out also. I just want a
> button with a label.

I take it that what you want to get rid of is the the prelight
that occurs when you move your button across the window. I think
the best way to do this is to create a new style that has the
prelight color the same as the un-prelighted color

The way to do this now:

  style = gtk_style_new()
  style->bg[GDK_STATE_PRELIGHT] = style->bg[GDK_STATE_NORMAL];
  gtk_widget_set_style (widget, style);

But this isn't really right, because it overrides the style
specified in the rc file, if there is any. In the future, 
you should be able to do something like:
 
  gtk_container_add (GTK_CONTAINER(parent), widget);
  gtk_widget_realize (widget);
  style = gtk_style_copy (widget->style);
  style->bg[GDK_STATE_PRELIGHT] = style->bg[GDK_STATE_NORMAL];
  gtk_widget_set_style (widget, style);

As long as you don't modify the normal background color. (Widgets
usually set this in their realize() function - but the explicit
realize is necessary to get the widget style from the rc file.
This probably needs fixing)

Or you could set up an appropriate style in your rc file.
(See the tutorial for more information.)

Regards,
                                        Owen



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