Re: using enter on numeric keypad in gtk

> Dave Reed <dreed capital edu> writes:
> > It seems that pressing the <enter> key on the numeric keypad produces a
> > space rather than an "activate" event in textfields.  Is there a way to make
> > it produce an "activate" event like the regluar <enter> key?
> > 
> GTK should likely do this by default, but you can work around it by
> connecting a signal handler to key_press_event like this:
> gint
> key_press_handler (GtkWidget *widget, GdkEventKey *event, gpointer data)
> {
>   if (event->keyval == GDK_KP_Enter)
>     event->keyval = GDK_Return;
>   return FALSE;
> }
> At least, I'd expect that to work.

Looks like it would, except I'm using PyGTK and Python complains about
event being a "read-only" structure.

I tried using widget.emit('activate') if it's GDK.KP_Enter, but that
also puts some sort of extra character in the text widget so I'd have
to make a hack to remove that character.


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