Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question
    
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. –  Rafał Cieślak Jun 28 '12 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. –  Nickolas Jun 28 '12 at 18:06

1 Answer 1

up vote 0 down vote accepted

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.