 |
| View previous topic :: View next topic |
| Author |
Message |
Mikey
Joined: 02 May 2006 Posts: 10
|
Posted: Sat May 06, 2006 3:45 am Post subject: GTKTreeView/Store items not displaying properly |
|
|
I've combed through the docs and can't figure this out:
| Code: |
// get GTKTreeView listClientProjects through GladeXML first
// test fill store
$cpStore = new GtkTreeStore(Gtk::TYPE_STRING, Gtk::TYPE_STRING);
$cpStore->append(NULL,array('Test1','1'));
$cpStore->append(NULL,array('Test2','2'));
$cpStore->append(NULL,array('Test3','3'));
// add columns
$this->listClientProjects->append_column(new GtkTreeViewColumn('Column1', new GtkCellRendererText(), 'text', 0));
$this->listClientProjects->append_column(new GtkTreeViewColumn('Column2', new GtkCellRendererText(), 'text', 0));
$this->listClientProjects->set_model($cpStore);
|
Unfortunately, I can only get this to work if I have ONE column. Once I go to two or three columns, the FIRST item in the array is repeated for each column. This happens even if the second column and items are set to TYPE_LONG and integers.
Halp? |
|
| Back to top |
|
 |
stefan
Joined: 17 Apr 2006 Posts: 35 Location: Germany
|
Posted: Sat May 06, 2006 10:31 am Post subject: |
|
|
Hi, i guess you have to change the last zero of this line:
| Code: | | $this->listClientProjects->append_column... |
into the expected column-number for example:
first column = 0
second = 1
...
so your code should look like:
| Code: | $this->listClientProjects->append_column(new GtkTreeViewColumn('Column1', new GtkCellRendererText(), 'text', 0));
$this->listClientProjects->append_column(new GtkTreeViewColumn('Column2', new GtkCellRendererText(), 'text', 1));
|
|
|
| Back to top |
|
 |
Mikey
Joined: 02 May 2006 Posts: 10
|
Posted: Sat May 06, 2006 11:27 am Post subject: |
|
|
| stefan wrote: | Hi, i guess you have to change the last zero of this line:
|
Oh. My god. Thanks.
I had no idea what that value was supposed to be except from single-column examples - the PHP GTK 2 docs and Dev Inspector mentioned nothing about the last two columns in the constructor for GtkTreeViewColumn.
Thanks again. |
|
| Back to top |
|
 |
cweiske
Joined: 08 Dec 2005 Posts: 454 Location: Leipzig/Germany
|
Posted: Sun May 07, 2006 10:47 pm Post subject: |
|
|
| Mikey wrote: | | Dev Inspector mentioned nothing about the last two columns in the constructor for GtkTreeViewColumn. |
I fixed the php-gtk sources to include that info.
Dev_Inspector itself doesn't know anything about php-gtk or php classes in common, it just uses the Reflection API available in PHP5. The extensions have to provide special reflection information beside the code, and that will be available to the reflection API of php.
If the reflection info is wrong, Dev_Inspector shows the wrong, too. |
|
| Back to top |
|
 |
Mikey
Joined: 02 May 2006 Posts: 10
|
Posted: Mon May 08, 2006 7:23 pm Post subject: |
|
|
| cweiske wrote: | | Mikey wrote: | | Dev Inspector mentioned nothing about the last two columns in the constructor for GtkTreeViewColumn. |
I fixed the php-gtk sources to include that info.
Dev_Inspector itself doesn't know anything about php-gtk or php classes in common, it just uses the Reflection API available in PHP5. The extensions have to provide special reflection information beside the code, and that will be available to the reflection API of php.
If the reflection info is wrong, Dev_Inspector shows the wrong, too. |
Understood. Thanks, Christian! |
|
| 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
|
|
 |