Re: Set the background color in GTK1



Am Mo, den 19.04.2004 schrieb Kevin DeKorte um 21:27:
Marc,

Still does not work

          style = gtk_rc_style_new();
          style->bg[GTK_STATE_NORMAL] = color;
          style->color_flags[GTK_STATE_NORMAL] = (GtkRcFlags)
(style->color_flags[GTK_STATE_NORMAL] | GTK_RC_BG);       
          gtk_widget_modify_style(gtkwidget,style);
          gtk_widget_modify_style(drawing_area,style);
          gtk_rc_style_unref(style);

compiles and is executed, but does not do anything...

Hi again!

Coming back on the beloved color topic:

There seems to be some sort of bug or misunderstanding by me. The actual
change in color happens delayed on a hscale I'm using and switching
color on.

If the color is changed, nothing is drawn. After the next change in
value at the gui, the background is changing from grey to green
(SPEED_COLOR_ACTIVE) exactly at the position the slider has been at.

My question: how can I force a redraw on selected widgets or the whole
window when needed?

TIA,
Marc

P.S.: some code:

var
        st      : pGtkRcStyle;
        cola, colp      : TGdkColor;
begin
...
                { swap the visual focus }
                gdk_color_parse(SPEED_COLOR_ACTIVE, @cola);
                gdk_color_parse(SPEED_COLOR_PASSIVE, @colp);

                st := gtk_rc_style_new ();
                
                if (target = 1) then begin
                        gtk_widget_grab_focus(GTK_WIDGET(scales[1]));
                        st^.bg[GTK_STATE_ACTIVE] := colp;
                        st^.color_flags[GTK_STATE_ACTIVE] := 
                                 st^.color_flags[GTK_STATE_ACTIVE] OR GTK_RC_BG;
                        gtk_widget_modify_style(GTK_WIDGET(scales[0]), st);
                        //gdk_flush(); no use ...





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