Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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. – Rrjrjtlokrthjji Jun 28 '12 at 18:06
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.