Re: How to change GtkEntry background



Hi, you could try this:
void
on_button1_clicked    (GtkButton   *button,  gpointer   user_data)
{
  GtkStyle *style;
  GtkStyle *oldstyle;
  GdkColor color;
  GdkColor color2;

  color.red=65535;
  color.blue=0;
  color.green=0;
  color.red=0;
  color.blue=65535;
  color.green=0;

  oldstyle = gtk_widget_get_default_style();
  style = gtk_style_copy(oldstyle);
  style->bg[GTK_STATE_NORMAL] =color;
  style->bg[GTK_STATE_ACTIVE] =color2; 
  gtk_widget_set_style(button,style);
}

i do that to set a button's background color in a my own button class .
try to do that.


> I want to display some data in an array of Entry widgets, and I'd like
> to change the text background on a per-widget basis to represent a few
> bits of other data associated with each entry.  Is it possible?  I can
> only get a single-pixel-width line around the border to change colour,
> which is not very helpful.
> 
> The colours have to change whenever the content changes.
> 
> [What I'd _like_ to be able to do is something like
> 
>   gtk_widget_set_named_style(my_widget, "foo")
> 
> to make the widget use a style "foo" defined in an rc file]
> 
> -- 
> Quid enim est stultius quam incerta pro certis habere, falsa pro 
veris?
>                                                                  -- 
Cicero
> (setq reply-to
>   (concatenate 'string "Paul 
Foley " "<mycroft" '(#\@) "actrix.gen.nz>"))
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list
> 


___________________________________
Isaac Pernas Sánchez
Ingeniería Industrial
100014098 alumnos uc3m es








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