Re: [gtk-list] Accelerator question



Leonardo Zide <leonardo@centroin.com.br> writes:

>   Hi,
> 
>   I'm writing an application and I want to use the backspace key as an
> accelerator to one of the menu items but it doesn't work (all other keys
> work correctly). I decided to take a look at the GTK source and I found
> out that inside the function gtk_accelerator_valid () it's listed as an
> invalid accelerator. Why you're not allowed to use the backspace key as
> an accelerator ?

Because GTK+ allows you to change the accelerators in a menu by pressing
an accelerator while the mouse is over the menu. Delete is used to remove
the current accelerator.
 
>   Also, the program that I'm writing is a conversion of a Win32 program
> and sometimes I need to know if the Alt key is pressed. What's the best
> way to do that ?

Usually, the way you do that is use the 'state' field of events 
like key presses and mouse events. You can test

 if (event->state & GDK_MOD1_MASK)
  {
    /* Do ALT key stuff */
  }

You can also watch for key presses and key releases of the Gdk_Alt_L/
Gdk_Alt_R keys, but this is less reliable and more work.

Regards,
                                                     Owen




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