Re: Newbie question - colors



"Aubury, Mike" wrote:
>         DISPLAY "Hello World" TO somewidget ATTRIBUTE(RED)
> 
> So I need to set the foreground colour of the 'somewidget' to red (assume
> for the sake of argument that I'm using an Entry type field here).
> 
> In addition - in the definition of the form, I need to define what colour is
> used when text is input into an entry field.
> 
> Any simple examples ?

Hi Mike, I think this is the approved technique:

  rc_style = gtk_rc_style_new ();
  rc_style->bg[GTK_STATE_NORMAL].red = 65535;
  rc_style->bg[GTK_STATE_NORMAL].green = 0;
  rc_style->bg[GTK_STATE_NORMAL].blue = 0;
  rc_style->color_flags[GTK_STATE_NORMAL] = GTK_RC_BG;
  gtk_widget_modify_style (drawing_area, rc_style);
  gtk_rc_style_unref (rc_style);

(cut from an old mail from Havok) ... this is to set the background,
make the obvious changes to modify the fg. You can change font/etc. in
the same way.

HTH, John




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