#26067 [Ana->Csd]: node_get_cell_style doesn't work

From: Date: Fri, 23 Sep 2005 13:33:45 +0000
Subject: #26067 [Ana->Csd]: node_get_cell_style doesn't work
References: 1  Groups: php.gtk.dev 
Request: Send a blank email to php-gtk-dev+get-1689@lists.php.net to get a copy of this message
ID: 26067 Updated by: sniper@php.net Reported By: cweiske at cweiske dot de -Status: Analyzed +Status: Closed Bug Type: PHP-GTK related Operating System: windows xp PHP Version: 1.0.0 (PHP-GTK) Previous Comments: ------------------------------------------------------------------------ [2004-01-28 18:23:07] andrei@php.net By default the CTreeNodes do not have styles set. There are couple of things wrong with your script, consequently. You have to create a new style via "new GtkStyle()". Then you have to allocate the color correctly, by getting a colormap and using alloc() call on it. I modified the code to do that and it worked. ------------------------------------------------------------------------ [2004-01-19 00:17:35] sfox@php.net Actually it's returning a stdClass instead of a GtkStyle object - but only if the style hasn't been set using node_set_cell_style(). It looks like the style object isn't being initialised at the point of realization. The question is whether this is deliberate :) I'm still trying to verify this, one way or the other. BTW you're correct in assuming that the GtkCList equivalent works in much the same way; they use the same internal objects way deep in the mix (clistrow, cell). ------------------------------------------------------------------------ [2004-01-17 11:34:39] sfox@php.net Apologies Christian, I didn't notice this report was outstanding until today's bug summary came through. Looking into it. ------------------------------------------------------------------------ [2003-11-01 00:25:50] cweiske at cweiske dot de Description: ------------ The "node_get_cell_style" of the GtkCTree widget does not work, it just returns NULL. The same problem should apply to the GtkCList. Reproduce code: --------------- <?php dl( "php_gtk." . ( strstr( PHP_OS, "WIN") ? "dll" : "so")); function delete_event() { return false; } function destroy() { Gtk::main_quit(); } $window = &new GtkWindow(); $window->set_default_size( 200, 200); $window->connect('destroy', 'destroy'); $window->connect('delete-event', 'delete_event'); $tree = &new GtkCTree( 1, 0, array( "Style")); $window->add( $tree); $window->show_all(); $node = $tree->insert_node( null, null, array( "Text"), 5, null, null, null, null, false, false); $nodestyle = $tree->node_get_cell_style( $node, 0); print_r( $nodestyle);//should be NOT null $col1 = &new GdkColor(0, 56000, 0); $nodestyle->base[GTK_STATE_NORMAL] = $col1; $tree->node_set_cell_style( $node, 0, $nodestyle); Gtk::main(); ?> Expected result: ---------------- the cell style of the first tree cell should have a nice color ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=26067&edit=1

« previous php.gtk.dev (#1689) next »