Re: Change colour of an entry



On Wed, 3 Mar 2004, Johnny wrote:
I have this two functions where Style is a global variable GtkRcStyle and Widget
is the GtkEntry

void SetFgColor(char *Colore)
{
 GdkColor FgColor;

 gdk_color_parse(Colore,&FgColor);

 Style->fg[GTK_STATE_NORMAL]=FgColor;
 Style->color_flags[GTK_STATE_NORMAL] |= GTK_RC_FG;

here the compiler return me this error:
     " conversion from `int' to `enum GtkRcFlags'  "

 gtk_widget_modify_style(Widget,Style);
}

void SetBaseColor(char *Colore)
{
 GdkColor BaseColor;

 gdk_color_parse(Colore,&BaseColor);
 Style->base[GTK_STATE_NORMAL] = BaseColor;

here the compiler return me this error:
     " conversion from `int' to `enum GtkRcFlags'  "

 Style->color_flags[GTK_STATE_NORMAL] |= GTK_RC_BASE;


 gtk_widget_modify_style(Widget,Style);
}

if I change the code and I write
Style->color_flags[GTK_STATE_NORMAL] = GTK_RC_FG;
Style->color_flags[GTK_STATE_NORMAL] = GTK_RC_BASE;

the program change only foreground color or base color

What I have to do?
Hello Johnny,
you can write

Style->color_flags[GTK_STATE_NORMAL] =
(GtkRcFlags)(Style->color_flags[GTK_STATE_NORMAL] | GTK_RC_FG);

and

Style->color_flags[GTK_STATE_NORMAL] =
(GtkRcFlags)(Style->color_flags[GTK_STATE_NORMAL] | GTK_RC_BASE);

to activate the color changes.

Regards,
                    Peter
-- 
====================================================================
Peter Krüger

applied software solutions (appss) GmbH
Sandtorstr. 23
D-39106 Magdeburg
Germany

Phone:  +49-(0)391-54486-19388
Fax:    +49-(0)391-54486-19222
email:  krueger appss de
URL:    http://www.appss.de

Managing Director: Uwe Hess, Dietmar Schäfer
Register: HRB12386, AG Mageburg

"Virtual business becomes reality!"

This e-mail may contain confidential and/or privileged information. If
you are not the intended recipient (or have received this e-mail in
error) please notify the sender immediately and destroy this e-mail. Any
unauthorised copying, disclosure or distribution of the material in this
e-mail is strictly forbidden.
====================================================================




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