 |
| View previous topic :: View next topic |
| Author |
Message |
js_junior
Joined: 23 May 2006 Posts: 18 Location: Macaé, RJ, Brasil
|
Posted: Wed Jun 21, 2006 12:16 pm Post subject: Treeview + Gnope |
|
|
Hi all.
I'm starting to developer with PHP-Gtk2 + Gnope and have a problem with integration between the Treeview generated by Gnope and the call in my PHP-Gtk program.
Allready find for examples but I don't found a example of how made this integration.
Explain better:
<?php
$tree = $this->pcaa->get_widget("MyTree");
$render = new GtkCellRendererText();
$col = new GtkTreeViewColumn("Teste", $render, "text", 0);
$list = new GtkListStore(Gtk::TYPE_TEXT);
$text = "This is a dummie test.";
$list->append(array($text));
$tree->append_column($col);
?>
The code below is a slice of my main code. This not work. If somebody can help me, if possible, with a KISS example for this integration/call, I very appreciate.
Thanks for some help. Best regards for all and sorry for my English (that's terrible).
José S. Jr |
|
| Back to top |
|
 |
scott
Joined: 16 Feb 2006 Posts: 35
|
Posted: Wed Jun 21, 2006 2:26 pm Post subject: |
|
|
Hi Jose,
You have two problems in your code sample. First, there is no type it is Second, you didn't set the model for the tree view. Add the following line (after fixing the type) to your example and it should work:
| Code: | | $tree->set_model($list); |
|
|
| Back to top |
|
 |
ron_t
Joined: 11 Dec 2005 Posts: 78 Location: Gatineau, Quebec
|
Posted: Wed Jun 21, 2006 2:31 pm Post subject: |
|
|
| scott wrote: | Hi Jose,
You have two problems in your code sample. First, there is no type it is Second, you didn't set the model for the tree view. Add the following line (after fixing the type) to your example and it should work:
| Code: | | $tree->set_model($list); |
|
Also, you can read more about building a GtkTreeView, all the data types available for inclusion and how to use either a GtkTreeStore or GtkListStore as a model on the PHP-Gtk2 Blog. Here's the link to the first in the GtkTreeView series:
http://www.writingup.com/phpgtk2/0026_introduction_to_the_gtktreeview_part_1
Hope this helps.
-Ron T. |
|
| Back to top |
|
 |
js_junior
Joined: 23 May 2006 Posts: 18 Location: Macaé, RJ, Brasil
|
Posted: Wed Jun 21, 2006 2:33 pm Post subject: |
|
|
Hello Scott. Thanks, very thanks for answer.
Sorry. The code I write today direct in forum and forget the TYPE_STRING I write wrong TYPE_TEXT but in original code it's correct.
So, I will try that you say about set_model as soon come home (this is for a freelancer job and I do this in my house). Tomorrow I will post if works.
Again, thanks so mutch for you attention in answer and help me.
Best regards,
José S. Jr |
|
| Back to top |
|
 |
js_junior
Joined: 23 May 2006 Posts: 18 Location: Macaé, RJ, Brasil
|
Posted: Wed Jun 21, 2006 2:38 pm Post subject: |
|
|
Ron, thanks for answer too.
Yesterday I print the examples in indicated site. But, I don't obtained made to work. Well, I think the problem can be the set_model that Scott tell.
Tomorrow, I will post the result of my test.
Thanks again. Best regards,
José S. Jr. |
|
| Back to top |
|
 |
js_junior
Joined: 23 May 2006 Posts: 18 Location: Macaé, RJ, Brasil
|
Posted: Thu Jun 22, 2006 12:01 pm Post subject: |
|
|
Hi guys.
How I promisse, I'm posting the test result. W O R K S !!!
That it lacks a single line make in program
Scott,
Thanks again. Your answer was short and direct in the point.
Best regards to all.
José S. Jr. |
|
| Back to top |
|
 |
ron_t
Joined: 11 Dec 2005 Posts: 78 Location: Gatineau, Quebec
|
Posted: Thu Jun 22, 2006 6:39 pm Post subject: |
|
|
| js_junior wrote: | Ron, thanks for answer too.
Yesterday I print the examples in indicated site. But, I don't obtained made to work. Well, I think the problem can be the set_model that Scott tell.
Tomorrow, I will post the result of my test.
|
Hi Jose,
I can't imagine what went wrong. Yours is the first indicator that any of the blog code isn't working. Perhaps I'd have to know a little more about your set-up. Or perhaps it's just difficult to follow the articles when they aren't in your own language. I'll have to look into translations into Spanish, German, French, etc.
Also, telling you about the blog was meant to answer any future questions you might have about the GtkTreeView rather than being a direct answer to your question. I know information overload can be frustrating.
Anyway, take care and I hope your treeview works out.
-Ron T. |
|
| Back to top |
|
 |
js_junior
Joined: 23 May 2006 Posts: 18 Location: Macaé, RJ, Brasil
|
Posted: Thu Jun 22, 2006 6:58 pm Post subject: |
|
|
Hi Ron.
First, I'm so sorry if my replay was not clear. How I sad in first message, my English is very bad.
About the blog, it's amazing. Congratulations for your job. Really.
I know and read yours text about Treeview before yeasterday. The code that I post as example was based in your article. The only thing that I don't found in your text was about Scott's tell: need make a link between treeview and the ListStore's model with a "set_model". Really, I don't found this. This is a "simple question" but, for begginers (just like me) this requirement was not clear.
But, no problem. How I sad, is hard to found helps how we have found in your blog. Congratulations again.
Thanks for your attention. Best regards,
José S. Jr. |
|
| Back to top |
|
 |
ron_t
Joined: 11 Dec 2005 Posts: 78 Location: Gatineau, Quebec
|
Posted: Fri Jun 23, 2006 7:01 am Post subject: |
|
|
| js_junior wrote: |
The only thing that I don't found in your text was about Scott's tell: need make a link between treeview and the ListStore's model with a "set_model". |
Woops! You're absolutely right, José. I've updated the article with a new section near the end mentioning the set_model() method.
The original draft of the article talked about it, but somehow I overlooked it in the final posting.
Thanks for bringing this to my attention, José. If you find anything else that isn't clear, please don't hesitate to tell me.
Take care.
-Ron T. |
|
| Back to top |
|
 |
js_junior
Joined: 23 May 2006 Posts: 18 Location: Macaé, RJ, Brasil
|
Posted: Fri Jun 23, 2006 12:23 pm Post subject: |
|
|
What can I say? Just, thaks Ron!!! And don't forget the next part of treeview article (I'm waiting for... The challenger now is get the selection and use the frist col in function)
Take care!
JJr |
|
| Back to top |
|
 |
|
|
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
|
|
 |