Re: GtkStyle this time....

From: Date: Thu, 26 Jul 2001 16:14:15 +0000
Subject: Re: GtkStyle this time....
References: 1  Groups: php.gtk 
Request: Send a blank email to php-gtk+get-2360@lists.php.net to get a copy of this message
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

« previous php.gtk (#2360) next »