connecting a callback to a "key_press_event" signal on a button



I have an keyboard-driven app that I am porting from GTK+ 1.2 to 2.0.

I use the following code to create a button (I do this repeatedly to create
an array of buttons and pack them into a table) and call a callback every
time the user presses a keyboard key while a gtk_button has focus.

        buttons[cnt] = gtk_button_new_with_label(lbl);
        gtk_widget_ref(buttons[cnt]);
        gtk_object_set_data_full (GTK_OBJECT (playa), title, buttons[cnt],
                                (GtkDestroyNotify) gtk_widget_unref);
        gtk_widget_show(buttons[cnt]);
        gtk_signal_connect (GTK_OBJECT(buttons[cnt]), "key_press_event",
                        GTK_SIGNAL_FUNC (on_button_pressed), NULL);



Everything worked fine on 1.2.  On 2.0 however, the callback is never
getting called.

Any ideas?

Thanks




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