gtkspinbutton key press handler
- From: varun_shrivastava <shrivastavavarun yahoo co in>
- To: gtk-devel-list gnome org
- Subject: gtkspinbutton key press handler
- Date: Mon, 30 Jul 2007 05:30:08 -0700 (PDT)
hi
Actually i was trying to modify the code of gtkspinbutton so that if i press
up and down arrow keys it should change focus between other gtkspinbuttons
(i don't want to use tab key). By default it increments or decrements the
value.
What i found that arrow keys have been binded to "change_value" signal. So
when arrow key press is there "change_value" function handler is being
called and behaves accordingly.
And also i found that there is no key_press_event handler defined in
class_init() function.
so inorder to have the behavior i want, i provided a keypress handler which
looks like
static gint
gtk_spin_button_key_press (GtkWidget *widget,
GdkEventKey *event)
{
gboolean retval;
switch(event->keyval)
{
case GDK_Up:
retval = FALSE;
break;
case GDK_Down:
retval = FALSE;
break;
case GDK_Right:
gtk_spin_button_real_change_value
(GTK_SPIN_BUTTON(widget),GTK_SCROLL_STEP_UP);
retval = TRUE;
break;
case GDK_Left:
gtk_spin_button_real_change_value
(GTK_SPIN_BUTTON(widget),GTK_SCROLL_STEP_DOWN);
retval = TRUE;
break;
}
return retval;
}
now it behaves as i want but whats happening is a mystery to me.
what i suppose is key_press_handler is being called instead of
change_value_handler
but how gtk decides whether to call a keypress handler or handler of the
signal binded by using gtk_binding_entry_add_signal()?
I just tried to experiment by providing a key press handler.
can any one help please
bye
--
View this message in context: http://www.nabble.com/gtkspinbutton-key-press-handler-tf4169823.html#a11862791
Sent from the Gtk+ - Dev - General mailing list archive at Nabble.com.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]