GtkStyle this time....

From: Date: Tue, 24 Jul 2001 18:47:22 +0000
Subject: GtkStyle this time....
Groups: php.gtk 
Request: Send a blank email to php-gtk+get-2341@lists.php.net to get a copy of this message
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

« previous php.gtk (#2341) next »