| View previous topic :: View next topic |
| Author |
Message |
meman
Joined: 25 Feb 2006 Posts: 11 Location: Germany
|
Posted: Tue Mar 21, 2006 9:19 pm Post subject: Comboentry in liststore |
|
|
Hi there,
is there any possibility to crate a column within a liststore, where i get a dropdown list when i edit this cell?? maybe its possible with cellrenderercombo, but i have no idea how to start. |
|
| Back to top |
|
 |
cweiske
Joined: 08 Dec 2005 Posts: 454 Location: Leipzig/Germany
|
Posted: Tue Mar 21, 2006 9:55 pm Post subject: |
|
|
| When creating the column, you need to pass the cellrenderercombo instance as renderer. |
|
| Back to top |
|
 |
meman
Joined: 25 Feb 2006 Posts: 11 Location: Germany
|
Posted: Thu Mar 23, 2006 5:34 pm Post subject: |
|
|
| yeah, but how do i implement the items for the dropdownlist, the same way as with the comboboxentry?? |
|
| Back to top |
|
 |
cweiske
Joined: 08 Dec 2005 Posts: 454 Location: Leipzig/Germany
|
Posted: Thu Mar 23, 2006 5:40 pm Post subject: |
|
|
You have to set the model, and the text-column property.
| Code: |
//List with allowed categories
$categories = new GtkListStore(Gtk::TYPE_STRING);
$categories->append(array('Editors'));
$categories->append(array('Games'));
$categories->append(array('Setup'));
$categories->append(array('Office'));
//Column: Category
$rendererCategory = new GtkCellRendererCombo();
$rendererCategory->set_property('model' , $categories);
$rendererCategory->set_property('text-column', 0);
$rendererCategory->set_property('editable' , true);
//$rendererCategory->set_property('has-entry' , false);
$columnCategory = new GtkTreeViewColumn(
'Category', //title
$rendererCategory, //the renderer
'text', //use that property
2 //data is in that model column
);
$view->append_column($columnCategory);
|
|
|
| Back to top |
|
 |
meman
Joined: 25 Feb 2006 Posts: 11 Location: Germany
|
Posted: Sun Mar 26, 2006 10:38 am Post subject: |
|
|
Looks great, i will try it today.
thanx a lot christian.
but one more question: is it possible to have a tree inside the dropdownlist instead of a simple list?? and how is it done? |
|
| Back to top |
|
 |
cweiske
Joined: 08 Dec 2005 Posts: 454 Location: Leipzig/Germany
|
Posted: Sun Mar 26, 2006 9:58 pm Post subject: |
|
|
| meman wrote: | | is it possible to have a tree inside the dropdownlist instead of a simple list? |
It should be possible, if you use a GtkTreeStore instead of a GtkListStore |
|
| Back to top |
|
 |
meman
Joined: 25 Feb 2006 Posts: 11 Location: Germany
|
Posted: Mon Mar 27, 2006 11:52 am Post subject: |
|
|
yep, i found out how its done on my own yesterday.
thx a lot for your help |
|
| Back to top |
|
 |
ssiwek
Joined: 15 May 2006 Posts: 20
|
Posted: Thu Sep 21, 2006 4:27 pm Post subject: |
|
|
Hi!
How do I preset a value for a categorie in the GtkCellrendererCombo?
And how do I retrieve a value from that?
have a nice day
Sven |
|
| Back to top |
|
 |
|