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 Nov 01, 2014 8:26 am

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Clear treeview liststore and re-populate it
PostPosted: Sat Jun 08, 2013 9:45 pm 
Offline

Joined: Thu May 23, 2013 7:36 pm
Posts: 2
I have 2 treeviews and the first one contains elements that have sub-elements which are displayed in the second one. When I move the cursor from en element to another, I have to refresh the sub-elements treeview. I tried to clear a treeview liststore and re-populate it but I couldn't. I tried the above code without success (when I try to re-populate, the program exits without printing any exception).

Code:
void addSubElementEntry(gchararray data1,
                                      UINT         data2)

{
   GtkListStore *liststore;
   GtkTreeIter iter;
   
    liststore = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(subElementsTreeview)));
    gtk_list_store_append(liststore, &iter);
         gtk_list_store_set (liststore, &iter,
                                         0, data1,
                                         1, data2,
                                         -1);
}
void on_elementsTreeview_cursor_changed (GtkButton *button, gpointer user_data)
{
   gtk_list_store_clear(subElementsTreeviewListstore);
        //Re-populate
        addSubElementEntry(data1,
                                        data2);
}


Top
 Profile  
 
 Post subject: Re: Clear treeview liststore and re-populate it
PostPosted: Sun Jun 09, 2013 5:59 am 
Offline
Never Seen the Sunlight

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

Without more details all I can do is guess at what is happening.

My only thought given what I have is that gtk_tree_view_get_model() is returning a NULL pointer. The best thing to try is to compile your code with debugging symbols and run it through a debugger such as Nemiver. This way you can find the exact point your code fails and what the variables are at the time.

_________________
E.


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: No registered users 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:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group