note 158 added to gtk.gtkctree.php
| From: | monkey@php.net | Date: | Fri, 28 Jun 2002 21:01:03 +0000 |
| Subject: | note 158 added to gtk.gtkctree.php | ||
| Groups: | php.gtk.webmaster | ||
| Request: | Send a blank email to php-gtk-webmaster+get-507@lists.php.net to get a copy of this message | ||
After much pulling of hair, here's how to get the text from a row when it is selected. Take
the previous 'hello, world' CTree example and add this after defining $tree, $node, and
$leaf:
------------------------------------
$tree->connect('select-row', 'selectedRow');
function selectedRow($tree,$row){
$node = $tree->node_nth($row);
$pixtext = $tree->node_get_pixtext($node,0);
echo $pixtext[0] . "\n";
}
----------------------------------
If you run the script from a shell/DOS prompt you should see the text of whichever node you click on
displayed in the shell window. node_get_text doesn't work, for reasons I don't pretend to
understand. No slight against PHP-GTK; GtkCTree seems to be universally reviled among GTK
programmers from all languages (myself included! :P )
http://gtk.php.net/manual/en/gtk.gtkctree.php