1

I have successfully manage to add an accelerator to a menu item with the gtk_widget_add_accelerator() function.

What bothers me is how i can add a custom accelerator that widget.With the first command i can add a shortcut like "Ctrl + A"; but what happens if i want to use the "Up" arrow key or F1 as an accelerator?

2
  • 1
    You will probably need to implement this using your own handler. However, I recommend you to ask on stackoverflow.com, as this programming question is barely related to Ubuntu itself. Jun 28, 2012 at 18:00
  • I agree that stackoverflow is a better place to ask,on the other hand i am aware that questions regarding application development on ubuntu are valid,so i guess it's not offtopic.
    – dlin
    Jun 28, 2012 at 18:06

1 Answer 1

0

I managed to replace Ctrl + something with something itself.

That can be done simply by setting the value of GdkModifierType, which is the second from last parameter,to zero.

For instance:

gtk_widget_add_accelerator(menu_item.fullscreen, "activate", accel_group, 
GDK_F11, 0, GTK_ACCEL_VISIBLE);

This will display F11 instead of Ctrl + F11.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .