[Glade-users] Disabling menu accelerators for certain widgets?



I have a menu accelerator tied to space. There is a search box in the
application. When I enter text in the search box I want to disable the
space accelerator to make it possible to enter spaces in the search
text. Is this possible?

I've tried to catch key_press_events for the search box and return TRUE,
but it does not work:

gboolean
on_searchentry_key_press_event         (GtkWidget       *widget,
                                         GdkEventKey     *event,
                                         gpointer         user_data)
{
         print_status("Key pressed");
         if (event->keyval == GDK_space) {
           /* Accelerator will still kick in here... */
                 gtk_signal_emit_stop_by_name(GTK_OBJECT(widget),
"key_press_event");
                 return TRUE;
         }
         if (event->keyval == GDK_Tab) {
           /* This disables GTK's handling of Tab */
                 gtk_signal_emit_stop_by_name(GTK_OBJECT(widget),
"key_press_event");
                 return TRUE;
         }
         return FALSE;
}

I was hoping there was an easy option in glade to say that accelerators 
should not be applied to certain widgets, but haven't found it yet. Any 
ideas on what to do?

Niklas





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