Re: Entrys focus



On Thu, 5 Jan 2006, Tim Janik wrote:

On Thu, 5 Jan 2006, Martyn Russell wrote:

On Wed, 2006-01-04 at 16:16 +0100, Tim Janik wrote:
On Wed, 4 Jan 2006, Juan Pablo wrote:
Martyn Russell wrote:
Have a look at gtk_container_set_focus_chain ().  If for example, you
have a GtkHBox with 3 GtkEntry widgets in it, the GtkHBox is the
container you would use to get or set the focus chain.

Thank you for this, it help me with my ooother problem :) but it is not what
i asked about :-p.
I have a window with a lot of entrys and the user needs to complete them
quick and easy.
So, when he press enter i need the next entry get the focus. Just like
pressing tab but with enter.
May I do this by checking the enter key press and emiting a tab? That could be a lot of code for a dialog with 30 entrys if I have to do it one by one,
but if it works and there is no other way...

you probably want to connect to the entrie's button-press event

OR you might want to use the "activate" signal for the GtkEntry, that
would save you the hassle of playing with the event details to find out
if they pressed enter or some other key.

and call gtk_window_move_focus() from there.

Tim, I think you meant gtk_widget_grab_focus() or gtk_window_set_focus()
here.

no, those functions don't advance the focus widget, which was requested to
occour upon enter.

as martyn rightfully points out to me on IRC, gtk_window_move_focus() is
not exported. the corresponding signal is however, and may freely be emitted
since it is a G_SIGNAL_ACTION signal, so moving focus TAB-alike programatically can be achieved by:
  g_signal_emit_by_name (window, "move-focus", GTK_DIR_TAB_FORWARD);


--
Regards,
Martyn

---
ciaoTJ



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