| View previous topic :: View next topic |
| Author |
Message |
lirm
Joined: 16 Dec 2005 Posts: 6
|
Posted: Fri Dec 16, 2005 11:47 am Post subject: minas |
|
|
I have installed the package in win2000 prof and winXP prof.
In winXP there was an error saying that the user had not administrator access, although I had logged in as administrator.
I don't see any trouble except that in both installations the Scribble demo does not work.
and a question:
Are there any replacements of the methods of class GtkCTree
node_set_row_data() : Associate a custom object with the row.
node_get_row_data() : Returns the custom object associated with the node.
in the new class GtkTreeView
Thank you
Minas |
|
| Back to top |
|
 |
cweiske
Joined: 08 Dec 2005 Posts: 454 Location: Leipzig/Germany
|
Posted: Fri Dec 16, 2005 5:27 pm Post subject: Re: minas |
|
|
| lirm wrote: | Are there any replacements of the methods of class GtkCTree
node_set_row_data() : Associate a custom object with the row.
node_get_row_data() : Returns the custom object associated with the node.
|
GtkTreeView is just for displaying the data visually. The data itself is stored in a GtkListStore or a GtkTreeStore, depending on what type of data you have.
You create the store (model), add data and add it to the gtktreeview via the set_model method. Or create it, set it and add the data afterwards.
If you need example code: PEAR_Frontend_Gtk2 uses GtkListStores for the package category list and the packge list. The stock_browser php-gtk2 demo uses it, too.
And Gnope_AppRunner uses a GtkIconView with an associated model. |
|
| Back to top |
|
 |
lirm
Joined: 16 Dec 2005 Posts: 6
|
Posted: Fri Dec 16, 2005 11:18 pm Post subject: |
|
|
Thank you for your answer Christian.
I append rows in GtkTreeStore object like this:
$ChoiceNd = $modTree->append($App1Sub1Nd, array('Choice 1', 'Form01'));
In the tree only one column is visible.
I have made a connection to the tree object like this:
$Tree->connect('row-activated', 'row_activated');
How can I have access into the "row_activated" function to the array passed in "append" method;
Two questions:
Is it possible in gtk2 to have editable lists with different types of columns, I mean strings, choice lists, check-boxes, etc?
I downloaded the php-gtk2 manual from your site but it is very poor for the time being. Is there something better?
Minas |
|
| Back to top |
|
 |
lirm
Joined: 16 Dec 2005 Posts: 6
|
Posted: Sat Dec 17, 2005 8:55 am Post subject: another question please!!! |
|
|
| How can I see greek in my widgets? |
|
| Back to top |
|
 |
cweiske
Joined: 08 Dec 2005 Posts: 454 Location: Leipzig/Germany
|
Posted: Sat Dec 17, 2005 10:56 am Post subject: |
|
|
| lirm wrote: | | In the tree only one column is visible. |
Did you create columns?
If you are not using GtkIconView but GtkTreeView, you have to create you own columns:
| Code: | $cell_renderer = new GtkCellRendererText();
$nDataColumn = 0;
$column = new GtkTreeViewColumn("column title", $cell_renderer, "text", $nDataColumn);
$column->set_resizable(true);
$tree->append_column($column); |
| Quote: | I have made a connection to the tree object like this:
$Tree->connect('row-activated', 'row_activated');
How can I have access into the "row_activated" function to the array passed in "append" method; |
In PHP-Gtk2, you can't simply connect some signals of the view to get notified when something is selected or changed in the data.
For selection, use this:
| Code: | $selection = $this->trTree->get_selection();
$selection->connect('changed', array($this, 'selectTreeRow')); |
I took the code from Gtk2_VarDump, which is shipped with Gnope.
| Quote: | | Is it possible in gtk2 to have editable lists with different types of columns, I mean strings, choice lists, check-boxes, etc? |
Yes! Just use a different cell renderer.
| Quote: | | I downloaded the php-gtk2 manual from your site but it is very poor for the time being. Is there something better? |
Currently, the manual on my page is the best we have specifically for php-gtk2. We are working on it, and the manual is updated twice a day - but it's a slow process.
However, you can go to
http://developer.gnome.org/doc/API/2.0/gtk/index.html
and have a look at the original Gtk2 manual - the functions are the same, just that PHP-Gtk2 is object oriented. |
|
| Back to top |
|
 |
lirm
Joined: 16 Dec 2005 Posts: 6
|
Posted: Sun Dec 18, 2005 7:32 pm Post subject: |
|
|
| Christian thank's, you were very helpfull. |
|
| Back to top |
|
 |
kioto
Joined: 22 Dec 2005 Posts: 5
|
Posted: Thu Dec 22, 2005 8:08 pm Post subject: |
|
|
Sorry, i need a little explanation if it's possible about a procedure of insert
data on GTkTreeCellView. I have created the GtkListSt, GtkTreeViewColumn, GtkCellRendererText but i don't understand what method use to insert rows.
I have failure with GTkListStore->insert(), that i have looked from the manual of php-gtk2.
Can you post a little snaps of code.
Thanks so much and good work. |
|
| Back to top |
|
 |
cweiske
Joined: 08 Dec 2005 Posts: 454 Location: Leipzig/Germany
|
|
| Back to top |
|
 |
kioto
Joined: 22 Dec 2005 Posts: 5
|
Posted: Fri Dec 23, 2005 3:20 pm Post subject: |
|
|
Yes Cristian, i have read your manual and other info from GTk.org manual,
follow your advices on this board.
Can you write a single column with any rows just to undestand the basics step.
Thanks again. |
|
| Back to top |
|
 |
cweiske
Joined: 08 Dec 2005 Posts: 454 Location: Leipzig/Germany
|
Posted: Fri Dec 23, 2005 3:30 pm Post subject: |
|
|
| Quote: | | Can you write a single column with any rows just to undestand the basics steps. |
| Code: | <?php
$store = new GtkListStore(Gtk::TYPE_STRING);
$store->append(array('string 1'));
$store->append(array('string 2'));
$store->append(array('string 3'));
$list = new GtkTreeView($store);
$cell_renderer = new GtkCellRendererText();
$list->append_column(new GtkTreeViewColumn('String', $cell_renderer, 'text', 0));
$wnd = new GtkWindow();
$wnd->connect_simple('destroy', array('gtk', 'main_quit'));
$wnd->add($list);
$wnd->show_all();
Gtk::main();
?> |
|
|
| Back to top |
|
 |
kioto
Joined: 22 Dec 2005 Posts: 5
|
Posted: Fri Dec 23, 2005 3:51 pm Post subject: |
|
|
Yes Cristian work, i have confused 'text' (i suppose property) with a string
to pass it and then i don't understand the sense of this with the mvc concept
that the GtkTree implement.
Thanks for the courtesy.
P.S: Now i have downloaded the version for windows, connect_simple()
is not implemented. You think that i need to create a new version from
a source with a VC++. |
|
| Back to top |
|
 |
cweiske
Joined: 08 Dec 2005 Posts: 454 Location: Leipzig/Germany
|
Posted: Fri Dec 23, 2005 3:55 pm Post subject: |
|
|
| kioto wrote: | Now i have downloaded the version for windows, connect_simple()
is not implemented. |
From where did you download it? The version shipped with Gnope does definitely support connect_simple. |
|
| Back to top |
|
 |
kioto
Joined: 22 Dec 2005 Posts: 5
|
|
| Back to top |
|
 |
kioto
Joined: 22 Dec 2005 Posts: 5
|
Posted: Fri Dec 23, 2005 4:12 pm Post subject: |
|
|
The ftp version don't implement connect_simple(); because i have
copy your code and i have get the famous error: Call to undefined method
GtkWindow::connect_simple()......
I have replace connect_simple(); with connect_object() and your code
work as well.
However no matter, thus i learn how to build from source on win that i need
to know to avoid any problems.
Thanks again Cris. |
|
| Back to top |
|
 |
cweiske
Joined: 08 Dec 2005 Posts: 454 Location: Leipzig/Germany
|
Posted: Fri Dec 23, 2005 4:16 pm Post subject: |
|
|
| kioto wrote: | | The ftp version don't implement connect_simple(); |
The "ftp version" is an old one (sept or oct 2005), and the one from the gnope installer is compiled on mid/end nov 2005 - so it's newer and contains less bugs :) |
|
| Back to top |
|
 |
|