Need help getting iterator when clicking on a Gtk2 GtkListStore



Hi,

I've created at GtkTreeView containing a GtkListStore in Gtk 1.3.11. I then 
connected the GtkTreeView to a mouse click with:
      gtk_signal_connect( GTK_OBJECT(view),"button-press-event", 
			  GTK_SIGNAL_FUNC( click_CB), NULL );

Inside the callback, I'm trying to change the data in 1 of the columns, but I 
can't seem to get the syntax correct. I get the error:

gdspsim (pid:7409): Gtk-CRITICAL **: file gtkliststore.c: line 869 
(gtk_list_store_set): assertion `iter->stamp == list_store->stamp' failed

which leads me to believe I have an invalid iterator.

Here's the call back code. I also have no idea if I'm suppose to use 
gtk_tree_view_get_selection() to retrieve information about the event.

static void click_CB( GtkTextView *W, GdkEventButton *event )
{
  GtkTreeSelection *selection;
  GtkTreeIter iter;
  GtkTreeModel *model;

  selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(W));
  gtk_tree_selection_set_mode(selection, GTK_SELECTION_SINGLE);
  model = gtk_tree_view_get_model(GTK_TREE_VIEW(W));
  gtk_tree_selection_get_selected(selection,&model,&iter);
  gtk_list_store_set(GTK_LIST_STORE(model),&iter,0,"s",-1);
}

Thanks in advance for anyhelp

Regards,
Kerry



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]