Key binding for GtkButton howto



How to bind a keyevent to a button:

Example I want to close the window if user clicks on button or pressing
<CONTROL> + "x"
I have tryed the above but it will not work, whats wrong?

....

    GtkAccelGroup *grp=gtk_accel_group_new();
    buttondone=gtk_button_new_with_label("Done");
     editlangA=gtk_entry_new();

....


gtk_widget_add_accelerator(buttondone,"clicked",grp,GDK_CONTROL_L,"x",
           GTK_ACCEL_VISIBLE | GTK_ACCEL_SIGNAL_VISIBLE);

     gtk_signal_connect(GTK_OBJECT(buttondone),"clicked",
           GTK_SIGNAL_FUNC(GlosButtons),this);




--

http://www.algonet.se/~mikeh
E-mail: mikeh@algonet.se






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