Re: [PHP-GTK] GtkStyle this time....
[email protected] (Rich Payne)
| Newsgroups | php.gtk |
|---|---|
| Message-ID | <[email protected]> |
OK, I do have a follow on question though...and maybe this is due to my
poor understanding of GTK+ at this point. Are all the widgets supposed to
share the same GtkStyle object?
The reason I ask is that in building the GUI if I change the style
structure of one of the three main widgets (a Ctree, Clist and a
GtkText) all three seem to inherit the changes. However if I get the
GtkStyle object, copy it, change it and then change the widgets style
object to the new Style then it of course only effects that one.
I only ask becuase I can't seem to find a decent answer in the GTK+
docs/mailing lists etc.
thanks,
--rdp
On Thu, 26 Jul 2001, Andrei Zmievski wrote:
> Good catch, but this one is tougher than the last ones.. I will probably
> fix it after the conference.
>
> On Tue, 24 Jul 2001, Rich Payne wrote:
> >
> > OK, so I have another question. I've been playing with GtkStyles and have
> > come across something I just don't understand. Here's a little snipped of
> > code:
> >
> > function set_widget_style($widget, $colour) {
> > $current_widget_style=$widget->get_style();
> > var_dump($current_widget);
> > $new_widget_style=$current_widget_style->copy();
> >
> > $new_widget_style->base[GTK_STATE_NORMAL]=$colour;
> >
> > $widget->set_style($new_widget_style);
> > }
> >
> > and I call this passing it a widget (in this case a CList) and a
> > GdkColor. Now it works the first time and fails after that, and I think
> > Oh, of course, I'm assinging the style to a local variable, by the second
> > call that no longer exists. So just for fun I put the var_dump in there
> > and what do you know both times it returns a GtkStyle object.
> >
> > So, is that the correct behavior? I expected the var_dump to return a
> > NULL.
> >
> > Here's the error that php produces:
> > <b>Fatal error</b>: Underlying object missing or of invalid type in
> > <b>/home/richp/rdp_projects/teak/colour_selection.php</b> on line
> > <b>134</b><br>
> >
> > line 134 is $new_widget_style=$current_widget_style->copy();
> >
> > so my code is wrong (I think), but not failing the way I expected.
> >
> > Also if anybody has any good example of working with GtkStyles
> > (specifically changing them on the fly) that would be appreciated. the
> > GTK+ Docs are a little thin.
> >
> > TIA,
> > --rdp
> >
> > --
> > Rich Payne
> > [email protected] www.alphalinux.org
> >
> >
> > --
> > PHP GTK Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [email protected]
> > For additional commands, e-mail: [email protected]
> > To contact the list administrators, e-mail: [email protected]
> >
>
>
>
> -Andrei
>
>
--
Rich Payne
[email protected] www.alphalinux.org