• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 2. The Keyboard > Accelerators

2.4. Accelerators

A menu accelerator, also called a keyboard shortcut, is an application-defined key sequence that invokes a menu item. It gives the same result as though the user had selected the item with the mouse. Accelerators are always associated with menu items. In the same manner as items in the menu bar, accelerators are global to the window. When the user types an accelerator key, regardless of the focus control, a menu item is invoked. When an accelerator is triggered, the corresponding keystroke is consumed.[17]

[17] Accelerators run before the key event is delivered to the control and on some platforms use the low-level window system keyboard classification engine to process the key, destructively modifying the key event in operating system event queue. This stops the focus control from ever seeing the keystroke.

2.4.1. Specifying an Accelerator

Accelerators are represented in SWT using an integer encoding. The encoding consists of zero or more modifiers and a single character or key code. An accelerator that contains only modifiers is invalid and cannot trigger a menu item.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint