Re: GtkStyle this time....

From: Date: Thu, 26 Jul 2001 16:24:10 +0000
Subject: Re: GtkStyle this time....
References: 1  Groups: php.gtk 
Request: Send a blank email to php-gtk+get-2361@lists.php.net to get a copy of this message
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 > > rpayne@alphalinux.org www.alphalinux.org > > > > > > -- > > PHP GTK Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: php-gtk-unsubscribe@lists.php.net > > For additional commands, e-mail: php-gtk-help@lists.php.net > > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > > > > -Andrei > > -- Rich Payne rpayne@alphalinux.org www.alphalinux.org

« previous php.gtk (#2361) next »