GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Thu Oct 02, 2014 4:23 am

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: GtkListStore - stop editing a cell after "editing-started"
PostPosted: Fri Jul 27, 2012 7:10 am 
Offline
Familiar Face

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

Code:

void cell_end_edit(   GtkCellRenderer *cell,
                            GtkCellEditable *editable,
                            const gchar           *path_string,
                            gpointer         data ) {
   int i = 1;
   
}

void cell_start_edit( GtkCellRenderer *cell,
                            GtkCellEditable  *editable,
                            const gchar *path_string,
                            gpointer data ) {
   if ( GTK_IS_ENTRY( editable )) {
      .
      .
      do "something" here.
      .
      .
      gtk_cell_renderer_stop_editing( cell, TRUE );
   }
}

..
   renderer = gtk_cell_renderer_text_new ();
   g_object_set( G_OBJECT( renderer ), "editable", TRUE, "editable-set", TRUE, NULL );
   g_signal_connect( G_OBJECT( renderer ), "editing-started", ( GCallback )cell_start_edit, NULL );
   g_signal_connect( G_OBJECT( renderer ), "editing-canceled", ( GCallback )cell_end_edit, NULL );




After doing "something" i call "gtk_cell_renderer_stop_editing( cell, TRUE )" and "editing-canceled" singnal is send by cell. But the cell remain in edit mode and i must press "Esc" to exit from edit mode.
How can i solve that ?
Or maybe how can i detect a mouse click on a cell ?
Thanks !

_________________
c/c++ for ever


Top
 Profile  
 
 Post subject: Re: GtkListStore - stop editing a cell after "editing-starte
PostPosted: Fri Jul 27, 2012 12:19 pm 
Offline
Familiar Face

Joined: Thu Dec 15, 2011 6:23 pm
Posts: 36
Location: Hrvatska
errol write very good sample for GtkTreeView
did you see that sample ?
maybe it can fit ?

look at this post from topic GtkCellRendererSpin seg fault
errol also explain how signal works !


Top
 Profile  
 
 Post subject: Re: GtkListStore - stop editing a cell after "editing-starte
PostPosted: Fri Jul 27, 2012 12:35 pm 
Offline
Never Seen the Sunlight

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

I thunk you're calling gtk_cell_renderer_stop_editing() too soon. General rule when using anything tree view is not to call signal emitting functions from signal handlers, since this can easily leave tree view in bad state. Try calling that function from idle handler, which will give tree view enough time to set straight it's internal state.

Cheers,
Tadej


Top
 Profile  
 
 Post subject: Re: GtkListStore - stop editing a cell after "editing-starte
PostPosted: Mon Jul 30, 2012 8:09 am 
Offline
Familiar Face

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

I thunk you're calling gtk_cell_renderer_stop_editing() too soon. General rule when using anything tree view is not to call signal emitting functions from signal handlers, since this can easily leave tree view in bad state. Try calling that function from idle handler, which will give tree view enough time to set straight it's internal state.

Cheers,
Tadej


@tadeboro
I believe you have right.
Is better to detect a mouse click on a cell.
I must read docs for that.

thanks.

_________________
c/c++ for ever


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 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