Re: Building a "Login" dialog



You can also connect a simple callback like this:

void cb_grab_enter_signal (GtkEntry *text, GdkEventKey *event, gpointer *data)
{
   if ((event->keyval == GDK_KP_Enter)
   || (event->keyval == GDK_Tab)
   || (event->keyval == GTK_Return)) {

   ... do whatever ...

   }

}

Note you have to connect it like this:

   gtk_signal_connect (GTK_OBJECT(text_ent), "key_press_event",
                       GTK_SIGNAL_FUNC(cb_grab_enter_signal), obj);

DT

--
Technical Director - Virginia Center for Computer Music
http://www.virginia.edu/music/vccm.html


Evan Martin wrote:

On Fri, 2003-05-30 at 22:07, Fernando Conceio wrote:
Im building a login dialog, where the user enters with a username and a password. There is a button, how to make whem press <ENTER> on a gtk_entry(there is two) the gtk_button receives a clicked signal like in a html form?

See the documentation for gtk_entry_set_activates_default() and
gtk_dialog_set_default_response().







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