Re: Trees
| From: | Pablo Dall'Oglio | Date: | Fri, 07 Mar 2003 14:04:05 +0000 |
| Subject: | Re: Trees | ||
| References: | 1 2 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-3079@lists.php.net to get a copy of this message | ||
On Fri, 7 Mar 2003 12:01:22 +0200
"Andrew Smith" <andrew@bluebox.co.za> wrote:
> Hi
>
> GtkTree is quite limited, lacking features like indenting, recursive
> deselecting etc... (unless someone can help me implement those?).
>
> GtkCTree is far more powerful, but I have still not been able to handle one
> major shortfall - I can't seem to assign data to a tree node. For example:
>
> <?php
>
> if (!class_exists('gtk')) {
> if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN')
> dl('php_gtk.dll');
> else
> dl('php_gtk.so');
> }
>
> $window = &new GtkWindow();
> $window->connect_object('destroy', array('gtk',
> 'main_quit'));
> $window->connect('delete-event', 'delete_event');
>
> function delete_event() {
> return false;
> }
>
> $window->show();
>
> $ctree = &new GtkCTree(1, 0, array('Tree'));
$ctree->connect_object('tree-select-row', 'ClickRow');
> $window->add($ctree);
> $ctree->show();
>
> $node=$ctree->insert_node(null, null, array("Top Tree"),5, null, null,
> null,null, false,false);
> $node->set_data("id",99);
$ctree->node_set_row_data( $node, 'content');
and later...
inside ClickRow function...
function ClickRow($node)
{
global $ctree;
$node = $ctree->node_get_row_data($node);
echo $node . "\n";
return true;
}
>
> Gtk::main();
>
> ?>
>
> I get:
>
> Fatal error: Call to undefined function: set_data() in C:\gtk\ctree.php on
> line 24
>
> I need to assign data to that node, so that later when someone clicks on the
> node I can identify which item they have clicked on.
>
> Any suggestions?
>
> Thanks!
>
> --------------------------------------
> Andrew Smith
> The Blue Box Cape Town
> http://www.bluebox.co.za
> andrew@bluebox.co.za
> 021 683 6017 / 083 659 6106
>
>
>
> --
> PHP-GTK General Mailing List (http://gtk.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
:: Pablo Dall'Oglio (pablo@php.net)
:: Univates - IT Department +55 (51) 3714-7040
:: Linux User n. 223253, Lajeado, RS - Brasil
:: "Life's a Journey, Not a Destination" - Steven Tyler