GtkCTree
| From: | Joseph Crawford | Date: | Wed, 27 Oct 2004 15:43:26 +0000 |
| Subject: | GtkCTree | ||
| Groups: | php.gtk.general | ||
| Request: | Send a blank email to php-gtk-general+get-5167@lists.php.net to get a copy of this message | ||
Guys i am trying to create a GtkCTree that will show a list of
Networks/Servers for an IRC client.
I have the networks and servers in an array however i cant seem to get
the GtkCTree to work.
what exactly is a column in a CTree? i keep getting errors like this
Warning: insert_node(): the text array size (2) does not match the
number of columns in the ctree (1) in
/home/idle/PhpIRC/system/class/GUI.class.php on line 89
here is the code i have so far.
function serverList() {
$w = &new GtkWindow();
$w->set_usize('380', '240');
$w->set_title("Networks");
$w->connect("destroy", array('Actions', 'killwindow'), null);
$scrolledwindow = &new GtkScrolledWindow();
$scrolledwindow->set_policy(GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
$tree = &new GtkCTree(1, 0);
$networks = array();
$servers = array();
foreach($this->_parent->_networks as $network => $net) {
$networks[] = $network;
foreach($net['servers'] as $server) {
$servers[] = $server['host'].":".$server['port'];
}
}
$parent = $tree->insert_node(null, null, $networks, 5, null, null,
null, null, false, false);
$self = $tree->insert_node($parent, null, $servers, 5, null, null,
null, null, false, false);
$tree->show();
$vbox = &new GtkVBox();
$vbox->set_border_width(5);
$vbox->set_usize(100, -1);
$hbox = &new GtkHBox();
$hbox->set_border_width(5);
$scrolledwindow->add($tree);
$scrolledwindow->set_usize(250, -1);
$hbox->pack_start($scrolledwindow, false, false, 5);
$hbox->pack_start($vbox, false, false, 5);
$button = &new GtkButton("Connect");
$button1 = &new GtkButton("Add");
$button2 = &new GtkButton("Remove");
$vbox->pack_start($button, false, false, 2);
$vbox->pack_start($button1, false, false, 2);
$vbox->pack_start($button2, false, false, 2);
$w->add($hbox);
$w->show_all();
}
--
Joseph Crawford Jr.
Codebowl Solutions
codebowl@gmail.com
For a GMail account
contact me OFF-LIST