Handling the Return key


Can anyone explain to me how to go about handling the pressing of the return key in a data entry dialog? For instance, when the user is done entering data, pressing
the Enter button on the keyboard should fire the OK button on the dialog.

I can capture the "click" event easily enough. And I can capture the "key_press_event" and check to make sure it's a Return key, but how do I connect the two events to
the same GTK_RESPONSE_OK result?    The "click" event is established when
I set up the button (i.e. with gtk_dialog_add_button). But the key press is established with g_signal_connect, which sends control to a handler. If you're in a loop checking the user input, you can't easily go off to a separate handler.

There must be a simple way of doing this, but I have yet to figure it out.


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