Re: set custom entry background?



On Mon, 16 Nov 2015, Emmanuele Bassi wrote:

Hi;

On 15 November 2015 at 19:32, Allin Cottrell <cottrell wfu edu> wrote:
I'm trying to set a custom background for a GtkEntry (as a temporary thing,
by way of an alert for invalid input). I can do that fine for gtk 2 using
gtk_widget_modify_base(), but am struggling with gtk 3.

Use:

 gtk_style_context_add_class (gtk_widget_get_style_context (entry),
GTK_STYLE_CLASS_ERROR);

Themes will usually honour this style class for entries, and will set
a red "glow" around it.

Thanks, I like that approach; nice and concise.

Allin Cottrell


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