GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Sat Jul 26, 2014 5:07 am

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: How to make dynamic GtkListStore ?
PostPosted: Mon Dec 31, 2012 8:49 am 
Offline
Familiar Face

Joined: Mon Jul 02, 2012 11:04 am
Posts: 5
Hi,

How to make dynamic GtkListStore ? Now I need to know how many columns will be in GtkListStore.
Wen I have listore = gtk_list_store_new ( 1, G_TYPE_STRING ); how to add additional columns of ?


Top
 Profile  
 
 Post subject: Re: How to make dynamic GtkListStore ?
PostPosted: Tue Jan 01, 2013 9:37 am 
Offline
Never Seen the Sunlight

Joined: Mon Apr 28, 2008 5:52 am
Posts: 733
Location: UK
Hello,

It is not totally clear what you need from your question.

To obtain the number of columns in your GtkListStore you will use
Code:
gint                gtk_tree_model_get_n_columns        (GtkTreeModel *tree_model);

Once your GtkListStore has been set up with the initial number of columns, these can not be changed. The underlying memory management would otherwise be huge.

There are ways around this. You can store everything that you need in the GtkListStore and only show what is needed in your GtkTreeView, you can then turn off or on what is needed at any time. This would be the recommended method. You can also store pointers for items that could have different types, note this is method also requires work to be done with the GtkTreeView. The second method is also much more complex.

_________________
E.


Top
 Profile  
 
 Post subject: Re: How to make dynamic GtkListStore ?
PostPosted: Wed Jan 02, 2013 9:06 am 
Offline
Familiar Face

Joined: Mon Jul 02, 2012 11:04 am
Posts: 5
Sorry for my English, I write with a translator :)

errol wrote:
You can also store pointers for items that could have different types, note this is method also requires work to be done with the GtkTreeView. The second method is also much more complex.

Please some code how to do this, or link.


Top
 Profile  
 
 Post subject: Re: How to make dynamic GtkListStore ?
PostPosted: Wed Jan 02, 2013 9:12 am 
Offline
Never Seen the Sunlight

Joined: Mon Apr 28, 2008 5:52 am
Posts: 733
Location: UK
You would be better to look at the documentation and tutorials at http://www.gtk.org/documentation.php. This would give you a better understanding of what can be done as the space for a reply here would be much too small.

_________________
E.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 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