Re: problem with grab_focus



>I have a problem with using gtk_widget_grab_focus in a
>focus_out_event hander, using gtk+-1.2.10.
>
>The attached program has three GtkEntry's, vertically aligned,
>and tries to grab focus on entry1 when I leave entry2.
>
>If I press key `GDK_Down' in the second entry (i.e., entry2),
>the default action of GTK+ moves cursor to entry3, while my
>handler moves cursor to entry1.  Thus, two cursors appear
>simultaneously.
>
>How could I have only entry1 focused?

its a kludge, but you can catch keypress events in entry{1,2,3}, and
gtk_signal_emit_stop_by_name() for GDK_{Down,Up,Left,Right} etc. this
will block the default (and often silly) GTK focus mechanism from
being driven by keystrokes in those widgets.

--p



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