GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Fri Aug 26, 2016 6:42 am

All times are UTC

Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: GtkCellrenderercombo in Glade
PostPosted: Sat Mar 20, 2010 11:41 pm 
Familiar Face

Joined: Sat Mar 06, 2010 11:52 am
Posts: 41
Hi everyone,

I am currently building an interface in glade that contains a treeview that is hooked up to a liststore object.

I would like it to behave like the "Add and remove columns" widget under the general tab when editing the liststore properties.

One column would allow the user to enter some text. The next column would allow the user to select an option out of a combo box. The data in the combo box will be populated during run time.

What column types should be chosen so that I have a Text Entry and a Combo box in my columns?

I found GtkCellRendercombo, but it does not seem to be in column type. I am also unsure what type to use for text entry.

Any help appreciated :)

 Post subject:
PostPosted: Sun Mar 21, 2010 12:17 pm 
Never Seen the Sunlight

Joined: Wed Jul 23, 2008 10:31 am
Posts: 2406
Location: Slovenia

I'm not sure what exactly are you trying to ask here, so I'll just describe how to build tree view like the one in glade tree view editor.

You'll need to create GtkTreeView and add two GtkTreeViewColumns into it. Into first column, you need to pack GtkCellRenderCombo, second column should have packed in GtkCellRendererText.

Underlying data storage will need to be composed from two GtkTreeModels: one for tree view itself and one for combo box cell renderer. Model for tree view will need to have (at least) two columns, both of type G_TYPE_STRING. Model for combo cell renderer will only need to have one G_TYPE_STRING column.

All that is left to do now is to connect "text" property of both cell renderers to appropriate columns in tree view model and set second model using g_object_set() to "model" property of combo cell renderer.


Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC

Who is online

Users browsing this forum: No registered users and 2 guests

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 post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group