failed manual note query
| From: | Unprivileged user | Date: | Sat, 13 May 2006 18:50:14 +0000 |
| Subject: | failed manual note query | ||
| Groups: | php.gtk.webmaster | ||
| Request: | Send a blank email to php-gtk-webmaster+get-3069@lists.php.net to get a copy of this message | ||
INSERT INTO note (user, note, sect, ts, lang) VALUES ('navarr@gmail.com','I found it
difficult at first to master making a tree and such, because the data is everywhere, but for those
who need it, here is how to go about doing it:
<?php
$window = &new GtkWindow();
$scroll = &new GtkScrolledWindow();
$store = &new GtkTreeStore(64,64); // Adds a Storage Area with Two Columns, both Text [Use
the GtkStockTypes for this]
$tree = &new GtkTreeView($store);
$col_id = &new GtkTreeViewColumn(\'Name\',new
GtkCellRendererText(),\'text\',0); // Creates a Column called \"Name\" for Text,
Makes it the First Column
$col_desc= &new GtkTreeViewColumn(\'Description\',new
GtkCellRendererText(),\'text\',0); // Creates a Column called \"Description\"
for Text, Makes it the Second Column.
$tree -> append_column($col_id);
$tree -> append_column($col_desc);
// ^ Adds the Columns to the Tree.
$scroll -> add($tree);
// ^ Adds the Tree to the Scrolling Window
$window -> add($scroll);
// ^ Adds the Scrolling Window to the Application Window
$window->show_all();
gtk::main();
?>
Now, if you ever wanted to add some data to this Tree (like if a user clicks a button or something)
Make sure that you pass it to the proper function, and include the variable $store.
Button Click:
<?php
// ...
$button->connect(\'clicked\',\'storefunc\',$store);
// ...
function storefunc($y,$store);
// $y represents the Item it was sent from.
// $store represents the Tree Store
$store->append(null,array(\'Test\',\'A Simple Testing Item\'));
// append requires the first to be the child that the item is for, if its not a child, its null.
Also, it requires that the values be in an Array, so even if you had a single row:
array(\'Stuff\')
}
// ...
?>','gtk.gtktreeview.php','2006-05-13 18:50:14','')