Re: Keep the focus in a GtkEntry



On Tue, 20 Nov 2001, Jean-Louis Schmitt wrote:

In a Window, I have several GtkEntry, and I have connected to them a
callback function through the focus_out_event signal. In this
function, I test the validity of the input. If this input is not
correct, after displaying an error message, I want this GtkEntry
continue to grab the focus. I try to do that with the
gtk_widget_grab_focus function, but this method doesn't work. I

You need to either

a) Stop the current key_press_event from propagating into the
GtkEntry widget.

b) Use an idle function to return the focus to the widget.

Read the FAQ and tutorial if you have doubts about how to do this.

suppose this function will be Ok only if called outside of the
concerned widget connected functions. Can somebody confirm? How can I
do to achieve this?

Your assessment isn't entirely correct. What is happening is that the
focus _is_ being set to the GtkEntry, but right after being shifted to
another widget when the tab is finally received in the widget. Signal
receival order isn't trivial; study it.

Take care,
--
Christian Reis, Senior Engineer, Async Open Source, Brazil.
http://async.com.br/~kiko/ | [+55 16] 272 3330 | NMFL




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