Re: styles - changing after show()




Todd Dukes <tdukes@ibmoto.com> writes:

> >> Can I change widget style after it's been showed? .. Before
> >> gtk_widget_show() I can change widget's background color but after it
> it
> >> just doesn't change.
> 
> >.. and to be bit more specific since this seems to work with other
> >widgets :) .. this happens with GtkText and when setting it's
> background
> >color, it just draws some thin borders and the rest is white..
> background
> >pixmap seemed to work.
>
> I see the same thing with GtkCombo. I have attached a small example that
> 
> uses gtk--. There is a label, a combo box, a button to toggle styles,
> and a
> button to quit. The label changes color from black on white to green on
> red.
> The combo just changes the outside rim of the entry field. If you click
> into
> the entry, the whole thing turns red. When you push the button to toggle
> 
> the colors again, the label returns to normal, but the combo leaves a
> thin
> red line.
> 
> I looked through the sources but am unable to figure out how this is
> supposed
> to work. Does anyone have any idea how this is supposed to work?

What needs to be done (and the process is underway in the development
branch) is to go through and supply handlers for the "style_set"
event for widgets that need more than the default handler.

Usually, this involves setting the background color of the widget's
various windows according to the new style. This is generally
an easy task, but some widgets, such as the Text widget, present
complications - so in the full  may not appear until GTK+-1.2. 

In some cases, you could probably hack around the current limitation
by providing your own "style_set" handler that replicates the
background setting in the widget's realize() handler.

Regards,
                                        Owen



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