[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: Keeping keyboard focus (ie GtkCLists)
- From: Mihai Bazon <mbazon websci ro>
- To: "Tara M" <learfox furry ao net>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Keeping keyboard focus (ie GtkCLists)
- Date: Wed, 8 Aug 2001 11:27:31 +0300
There's no need to use gtk_widget_grab_focus().
In your event-key handler, you must have something like this:
gboolean
on_key_press(GtkEventBox *eb, GdkEventKey *event, gpointer data)
{
switch (event->keyval) {
...
case GDK_Up:
... /* handle the event */
/* .. and then stop the signal */
gtk_signal_emit_stop_by_name(GTK_OBJECT(eb), "key_press_event")
return TRUE; /* return TRUE if you handled the signal */
...
}
}
By doing this you are telling Gtk+ that you don't want that key to be
reinterpreted anymore after your handler is run. This way, the signal
stops here.
eb is your event box.
Have fun!
//mishoo
On 07 Aug 2001 14:33:49 PDT
"Tara M" <learfox@furry.ao.net> wrote:
> I have a GtkWidget (an event box) that I needs to keep
> the keyboard focus after it recieves a GDK_EVENT_KEY_PRESS
> or GDK_EVENT_KEY_RELEASE where the keyval is one of the
> up, down, left, right arrows.
>
> Normally this event is recieved but then the focus is
> moved to the next or previous widget.
>
> I tried putting a gtk_widget_grab_focus() right after
> in the GdkEventKey handler but it dosen't work, the focus
> still gets moved.
>
> Any suggestions?
>
>
> --
> --
> Sincerely, ,"-_ \|/
> -Capt. Taura M. , O=__ --X--
> .__ ,_JNMNNEO=_ /|\
> OMNOUMmnne. {OMMNNNEEEEOO=_
> UOOOBIOOOEOMMn. 'LONMMMMNNEEEOOO=.__..,,..
> UUOOEUUOOOOOOOObe '"=OMMMMWNEEEOOOOO,"=OEEEOO=,._
> OOUUUIEEIOONNOIUbe. "7OMMMMNNNNNWWEEEEOOOOOO" "'.
> EEBNNMMMNWNWWEEIMMNe. __ 7EMMMNNNNNWWWEEEEEEEOO. " .
> NNMMMMWWWMMMWEINMMMNn "=BBEEEEMMMMMMMMNNNWWWEEOOOOO=._ .
> http://furry.ao.net/~learfox/
>
>
>
> _______________________________________________
> 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]