Re: [gtk-list] GtkEntry specific accelerators
- From: Jan Kellmer <jkellmer dialup nacamar de>
- To: Sean Christopher Rhea <srhea ece utexas edu>, gtk-list redhat com
- Subject: Re: [gtk-list] GtkEntry specific accelerators
- Date: Wed, 27 Jan 1999 21:23:25 +0100
Sean Christopher Rhea wrote:
> If I want to catch a specific key only when the focus is in a specific
> GtkEntry, is there a convenient way to do this? I have a GtkEntry for a
> number, and when '+' is pressed, I want the number incremented instead of
> a '+' being entered in the field.
>
> Sean C. Rhea
> http://www.ece.utexas.edu/~srhea
Connect the "key_press_event" of the entry widget to an event-handler of
your own. Inside the handler you can do what you want.
Simple
gtk_signal_connect(GTK_OBJECT(entryw), "key_press_event",
GTK_SIGNAL_FUNC(entry_key_event), NULL);
and
static gint editl_key_event(GtkWidget* widget,
GdkEventKey* event,
gpointer data){
gint key=event->keyval;
[...]
}
To get the meaning of "key", look at gdkkeysyms.h
Jan Kellmer
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]