gnope php gtk gui gnope.org  

minas

 
Post new topic   Reply to topic    gnope.org Forum Index -> PHP GTK2 Beginners
View previous topic :: View next topic  
Author Message
lirm



Joined: 16 Dec 2005
Posts: 6

PostPosted: Fri Dec 16, 2005 11:47 am    Post subject: minas Reply with quote

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

PostPosted: Fri Dec 16, 2005 5:27 pm    Post subject: Re: minas Reply with quote

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

PostPosted: Fri Dec 16, 2005 11:18 pm    Post subject: Reply with quote

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

PostPosted: Sat Dec 17, 2005 8:55 am    Post subject: another question please!!! Reply with quote

How can I see greek in my widgets?
Back to top
cweiske



Joined: 08 Dec 2005
Posts: 454
Location: Leipzig/Germany

PostPosted: Sat Dec 17, 2005 10:56 am    Post subject: Reply with quote

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

PostPosted: Sun Dec 18, 2005 7:32 pm    Post subject: Reply with quote

Christian thank's, you were very helpfull.
Back to top
kioto



Joined: 22 Dec 2005
Posts: 5

PostPosted: Thu Dec 22, 2005 8:08 pm    Post subject: Reply with quote

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

PostPosted: Thu Dec 22, 2005 10:42 pm    Post subject: Reply with quote

kioto wrote:
I have failure with GTkListStore->insert(), that i have looked from the manual of php-gtk2.

Did you already see the examples for GtkListStore I wrote this night?
http://php-gtk2.de/manual/en/html/gtk/gtk.gtkliststore.constructor.html
http://php-gtk2.de/manual/en/html/gtk/gtk.gtkliststore.method.insert.html
Back to top
kioto



Joined: 22 Dec 2005
Posts: 5

PostPosted: Fri Dec 23, 2005 3:20 pm    Post subject: Reply with quote

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

PostPosted: Fri Dec 23, 2005 3:30 pm    Post subject: Reply with quote

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

PostPosted: Fri Dec 23, 2005 3:51 pm    Post subject: Reply with quote

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

PostPosted: Fri Dec 23, 2005 3:55 pm    Post subject: Reply with quote

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

PostPosted: Fri Dec 23, 2005 4:04 pm    Post subject: Reply with quote

I have either gnome and the build version from a ftp server: http://ftp.emini.dk/pub/php/win32/gtk2/
Back to top
kioto



Joined: 22 Dec 2005
Posts: 5

PostPosted: Fri Dec 23, 2005 4:12 pm    Post subject: Reply with quote

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

PostPosted: Fri Dec 23, 2005 4:16 pm    Post subject: Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    gnope.org Forum Index -> PHP GTK2 Beginners All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Templates enhanced by DigiWiki. Hosting by Tradebit.