Re: How to catch enter pressed in a gtk entry text ?



You'll want to connect a keypress signal from the entry box to a
callback routine and check for the Enter keystroke.  If it's not enter,
just return false (I think), so the keystroke will be processed by gtk. 

Michael


On Tue, 2002-01-15 at 10:35, Flávio Alberto Lopes Soares wrote:
> Hello all,
> 
> I need to detect when I press enter in a gtk entry text, callback
> function is here:
> 
> void
> on_entry_senha_user_changed            (GtkEditable     *editable,
>                                         gpointer         user_data)
> {
>   gchar string_senha_user[10];
> 
>   int len;
> 
>   gchar *last_char;
> 
>   len = strlen(gtk_editable_get_chars(GTK_EDITABLE(user_data), 0, -1));
> 
>   last_char = gtk_editable_get_chars(GTK_EDITABLE(user_data), len - 1,
> len);
> 
>   strcpy(string_senha_user,
> gtk_editable_get_chars(GTK_EDITABLE(user_data), 0, -1));
> 
> 
>      if(*last_char == 13)
>       {
> 
>        verifica_senha_parametros(USER, string_senha_user, NULL);
> 
>       }
> }
> 
> I attempt to verify if the last character is the return (13) but I see
> that return doesn't generated the "changed" signal, how to do this ?
> 
> Thanks for any help
> 
> Flavio Alberto
> 
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list
-- 
Public key available from http://students.cs.byu.edu/~torriem


Attachment: signature.asc
Description: This is a digitally signed message part



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