[Glade-users] Changing the border colour of text entry box
Ishan Chattopadhyaya
ishanchattopadhyaya@hclinfinet.com
Tue, 18 Mar 2003 00:54:10 +0530
Dear Duarte,
I would have used the following code:
{ GdkColor color = {0, 65000, 0, 0}; /*{0, r, g, b };*/
GtkRcStyle *rc_style = gtk_rc_style_new ();
// Text insertion
gtk_entry_set_text(GTK_ENTRY(entry1), "hello world");
rc_style->bg[GTK_STATE_NORMAL] = color;
rc_style->color_flags[GTK_STATE_NORMAL] |= GTK_RC_BG;
gtk_widget_modify_style (entry1, rc_style);
gtk_rc_style_unref (rc_style);
return 1;
}
Regds,
Ishan
>Dear List Members,
>
>I'm trying to make a text entry box that could display some text and change
>the colour of the border. These changes (text entry, and border colours)
>will be made by a gtk_timeout_add function that will execute every second.
>
>I am able to do only one of these things.
>
>If I change the border colour of the text entry box and change the text,
the
>colour of the border will return to the original default colour. Why?
>
>There are some way that allow me to do both changes?
>
>An extraction of the code of the gtk_timeout_add function:
>
>gint function(gpointer user_data)
>{
>GdkColormap *colormap;
>GdkColor color;
>
>.
>
>/* Colour change */
>color.red=0xffff;
>color.green=0;
>color.blue=0;
>colormap = gdk_window_get_colormap(entry1->window);
>gdk_color_alloc(colormap, &color);
>gdk_window_set_background(entry1->window, &color);
>gdk_window_clear(entry1->window);
>
>/* Text insertion */
>gtk_entry_set_text(GTK_ENTRY(entry1), "hello world");
>
>return 1;
>}
>
>Best Regards,
>Duarte Duque
>
>_______________________________________________________________________
>Busca Yahoo!
>O serviço de busca mais completo da Internet. O que você pensar o Yahoo!
encontra.
>http://br.busca.yahoo.com/
>_______________________________________________
>Glade-users maillist - Glade-users@lists.ximian.com
>http://lists.ximian.com/mailman/listinfo/glade-users
>