Reputation: 8818
I've got a project written in c++ using gtkmm 3.0, and I'd like to be able to have the user press a key mapped to a button widget on the screen. I've sifted through 20+ pages of google results with no luck. Anyone know how? It would be greatly appreciated.
Upvotes: 1
Views: 217
Reputation: 715
This is how you'd do it in C to make the button click when you press Shift-F1:
GtkAccelGroup *accel_group = gtk_accel_group_new ();
gtk_window_add_accel_group (my_window, accel_group);
gtk_widget_add_accelerator (my_button,
"clicked",
accel_group,
GDK_KEY_F1,
GDK_SHIFT_MASK,
0);
Upvotes: 2