GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Tue Oct 21, 2014 4:45 pm

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: [SOLVED]GtkListStore first and last iter
PostPosted: Thu Jan 19, 2012 8:50 am 
Offline
Familiar Face

Joined: Fri Mar 25, 2011 7:55 am
Posts: 35
Location: romania
Hi,

how can i get the last iter from a GtkListStore list ?
for the first iter i found this.
valid = gtk_tree_model_get_iter_first( GTK_TREE_MODEL( list_store ), &iter );
and for the last iter ?

Thanks tadeboro !
Is working.

nodes = gtk_tree_model_iter_n_children( GTK_TREE_MODEL( list_store ), NULL );
// must go to nodes-1 to get the last element.
gtk_tree_model_iter_nth_child( GTK_TREE_MODEL( list_store ), &iter, NULL, nodes - 1 );
model = gtk_tree_view_get_model( GTK_TREE_VIEW( list_view ));
gtk_tree_model_get( model, &iter, ....., -1 );

_________________
c/c++ for ever


Last edited by perosoft on Thu Jan 19, 2012 11:43 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: GtkListStore first and last iter
PostPosted: Thu Jan 19, 2012 11:12 am 
Offline
Never Seen the Sunlight

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

You can use gtk_tree_model_iter_n_children() function to get number of rows in your list, then simply obtain nth iter using gtk_tree_model_iter_nth_child().

Cheers,
Tadej


Top
 Profile  
 
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: Google [Bot] and 3 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