Re: override tab behaviour



About forcing TAB to go to normal route -- I had this problem too, still unsolved.

But yes, you can override the TAB key. The gtk_emit_stop_by_name function still exists, but named "gtk_signal_emit_stop_by_name" (you forgot signal).

Example code:


gboolean on_key_press(GtkEntry *entry, GdkEventKey *event, gpointer data)
{
 if (event->type == GDK_KEY_PRESS) {
   if (event->keyval == GDK_Tab) {
     // do whatever you want to do when TAB pressed...
     gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event");
     return TRUE;
   }
 }

 return FALSE;
}


Cheers,
Mishoo

Huib Kleinhout wrote:

Hi
I am writing an app where data is inserted in a couple of textentries
followed by a press on a (OK) button which inserts the data in a list.
When data is inserted i want the focus automatically return to the first
textentry. I am using gtk_window_set_focus for this. But after a call of
the function the TAB navigation acts weird. It doesn't follow the normal
route anymore (left-right,top-down) but a hit on the TAB button returns
the focus to the previously pressed OK-button (instead of the next
(nearby) textentry)
Is there a way to force the tabbing behaviour to follow the normal
route?
Or Can i override the tab key and simulate the behaviour (i can do the
simulation but i can't find out how override the key) There is an old
post about something like this:
http://mail.gnome.org/archives/gtk-app-devel-list/2000-June/msg00460.html
Does the gtk_emit_stop_by_name() function still exist? Because i can't
find a prototype...
Thanks,
Huib Kleinhout




_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list




--

 ... and on the seventh day, He exited from append mode.







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