Re: changing a widget's color at runtime



John Cupitt wrote:

> Paul is right, you're better off with .gtkrc files. The trick is that
> you can set_name() at any time, changing the name updates the style, and
> it's a cheap call. In my app I have:
> 
> style "error_style" {
>         bg[]..
> }
> style "clean_style" {
>         bg[]..
> }
> style "leaf_style" {
>         bg[]..
> }
> etc.
> widget "*error_widget" style "error_style"
> widget "*clean_widget" etc.
> 
> Then when one of my widgets changes state, I set_name() to the new state
> ... and it is automcatically updated with the new style.
 
Ahhhhh!

I never even thought of this!

I guess I was sidetracked by the fact that parsing a resource file does not
affect the appearance of widgets created/realized/mapped/shown before the
parsing ... which in retrospect doesn't make a whole lot of sense either
...

> HTH,

you *bet* it does!

I thank you, Paul and gtk-list!




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