| View previous topic :: View next topic |
| Author |
Message |
kingrs
Joined: 15 Jan 2006 Posts: 30 Location: Stafford, UK
|
Posted: Tue Jan 17, 2006 7:49 pm Post subject: GtkClist and GtkTreeView in php-gtk2 |
|
|
Hi,
I cannot get the GtkClist append to work, it comes back as an undefined method. Worked in php-gtk1.
I know that it is deprecated but I still want to use it as I understand there are performance issues with GtkTreeView.
Failing that can someone supply me with a simple GtkTreeview code example.
And what is a GtkTreeStore?
Is the data part of a treeview?
I would give anything for a manual with worked examples of each widget.
Cheers
Rob King |
|
| Back to top |
|
 |
cweiske
Joined: 08 Dec 2005 Posts: 454 Location: Leipzig/Germany
|
Posted: Tue Jan 17, 2006 9:46 pm Post subject: Re: GtkClist and GtkTreeView in php-gtk2 |
|
|
| kingrs wrote: | I know that it is deprecated but I still want to use it as I understand there are performance issues with GtkTreeView.
Failing that can someone supply me with a simple GtkTreeview code example.
And what is a GtkTreeStore?
Is the data part of a treeview?
I would give anything for a manual with worked examples of each widget. |
Rob,
I know of no performance issues regarding the treeview, so you really should use the treeview.
I had a look at the generated classes yesterday, and GtkCList and GtkCTree have too much methods missing (around 75% missing).
The official php-gtk2 manual already contains an example for gtktreeview:
http://php-gtk2.de/manual/en/html/gtk/gtk.gtktreeview.constructor.html
The GtkTreeStore is the data model which contains all the data. The TreeView actually displays the data. |
|
| Back to top |
|
 |
cweiske
Joined: 08 Dec 2005 Posts: 454 Location: Leipzig/Germany
|
|
| Back to top |
|
 |
kingrs
Joined: 15 Jan 2006 Posts: 30 Location: Stafford, UK
|
Posted: Tue Jan 17, 2006 11:08 pm Post subject: OK I'm convinced |
|
|
75% methods missing???
I think they mean decapitated not depricated.
Goodbye GtkClist and hello GtkTreeView.
I tried the example and that seems to work fine and I understand the code which helps
Many thanks.
I can now carry on with my project.
I started out using php-gtk1 in preference to VB6 and then decided php-gtk2 would look so much better and would be more future proof, so I am now pushing for php-gtk2 as the new standard for all new GUI applications that we create at work as hard as I can.
Plus you can use it in Linux without re-write (I think).
Cheers
Rob King |
|
| Back to top |
|
 |
cweiske
Joined: 08 Dec 2005 Posts: 454 Location: Leipzig/Germany
|
Posted: Tue Jan 17, 2006 11:14 pm Post subject: Re: OK I'm convinced |
|
|
| kingrs wrote: | 75% methods missing???
I think they mean decapitated not depricated. |
PHP-Gtk2 is under development, and we are concentrating on the important things. The deprecated things will come at last. |
|
| Back to top |
|
 |
cweiske
Joined: 08 Dec 2005 Posts: 454 Location: Leipzig/Germany
|
Posted: Wed Jan 18, 2006 1:16 pm Post subject: |
|
|
| I just became aware that GtkTreeStore::insert, insert_after and insert_before are not implemented correctly. I'm about to fix that in CVS, and Gnope 1.1 (whenever it will come :)) will have the fix. |
|
| Back to top |
|
 |
kingrs
Joined: 15 Jan 2006 Posts: 30 Location: Stafford, UK
|
Posted: Wed Jan 18, 2006 1:51 pm Post subject: Add treestore to treeview, decimal places in treeviewcolumn |
|
|
Is it possible to add the treestore to a treeview already placed on the window?.
At the moment I have an empty scrolled window designed using glade and I have to create the treeview with the treestore, then add that to the scrolled window:
//We want to display our data in a GtkTreeView
$treeview = new GtkTreeView($store);
Also how do you specify the number of decimal places for a GtkTreeViewColumn?
Is it something to do with:
$cell_renderer = new GtkCellRendererText();
//Create the first column, make it resizable and sortable
$colLanguage = new GtkTreeViewColumn('Language', cell_renderer, 'text', 1); |
|
| Back to top |
|
 |
cweiske
Joined: 08 Dec 2005 Posts: 454 Location: Leipzig/Germany
|
Posted: Wed Jan 18, 2006 2:02 pm Post subject: Re: Add treestore to treeview, decimal places in treeviewcol |
|
|
| kingrs wrote: | | Is it possible to add the treestore to a treeview already placed on the window?. |
| Code: | | $view->set_model($store); |
| Quote: | | Also how do you specify the number of decimal places for a GtkTreeViewColumn? |
You need a cell renderer which supports setting such a setting. What you could do is making your own GtkNumberCellRenderer (derive from GtkTextCellRenderer) and overwrite the display method - but don't ask me how, I've never done this before :)
Look at the C sources of GtkTextCellRender how they did it. |
|
| Back to top |
|
 |
kingrs
Joined: 15 Jan 2006 Posts: 30 Location: Stafford, UK
|
Posted: Wed Jan 18, 2006 7:00 pm Post subject: |
|
|
| Quote: | | You need a cell renderer which supports setting such a setting. What you could do is making your own GtkNumberCellRenderer (derive from GtkTextCellRenderer) |
Could this be done using php script or would I need to do this in C and compiled?
I would not know where to start if it was in C.
I have tried to play with the column packing some more but cannot get it to do what I want.
Right justification of data will be very important to the success of the new treeview control, so something needs to be sorted out.
Cheers
Rob King |
|
| Back to top |
|
 |
cweiske
Joined: 08 Dec 2005 Posts: 454 Location: Leipzig/Germany
|
Posted: Wed Jan 18, 2006 8:48 pm Post subject: |
|
|
| kingrs wrote: | | Could this be done using php script or would I need to do this in C and compiled? |
Just do something like this:
| Code: | class MyRenderer extends GtkCellRendererText {
} |
and overwrite/define the method which actually draws the string. The most easy thing would be to take the value, format it and do a parent::drawthestring($customizedvalue).
But again don't ask me what the method is. |
|
| Back to top |
|
 |
|