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

Re: Entry widget and default OK button



Jan Rychter wrote:
> 
> I know this question must have been asked before, but looking through
> the list archives and docs I couldn't find an answer.
> 
> I have a dialog with an entry widget and a default OK button. I'd like
> the user to be able to just press Enter after entering something into
> the entry widget to exit the dialog. However, that does not seem to
> work.
> 
> How do I make the entry widget "default-capable"? Do I have to intercept
> the keypress events and look for Enter being pressed?

The Entry widget emits an 'activate' when you press return in it. Just
attach to the activate signal on the entry and do whatever you do when
your button is clicked.

From the GtkEditable docs:

The "activate" signal

 void        user_function                  (GtkEditable *editable,
                                             gpointer user_data);

Indicates that the user has activated the widget in some fashion.
Generally, this will be done with a keystroke. (The default binding for
this action is Return for GtkEntry and Control-Return for GtkText.)


-- 
René Seindal (rene@seindal.dk)			http://www.seindal.dk/rene/



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