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

Chapter 3. The Mouse > Mouse Events

3.1. Mouse Events

When a mouse button is pressed or the mouse is moved, a mouse event is created and normally delivered to the control that is beneath the cursor. However, when a mouse button is pressed and held, and the mouse is moved outside of the control (perhaps into another control or over the desktop), events are delivered to the original control that got the mouse press. When the mouse button is released, events are delivered normally. This temporary redirection of events is called mouse capture or grabbing. The control that receives the events is called the grab control. Mouse capture happens automatically in SWT. It is something that you need to be aware of but need not be concerned with. Most programmers simply expect the mouse to behave in this manner.[3]

[3] On X Windows, grabbing is built into the operating system.

3.1.1. Mouse Buttons, Coordinates, and the State Mask

When the mouse is pressed or released, the button field of the mouse event that is generated contains the number of the button that was pressed. Mouse buttons are numbered from left to right, using consecutive integer values starting from 1. For users who are left-handed (and configure the operating system for a left-handed person), the button numbering scheme remains the same but the buttons are arranged physically from right to left. This mapping for left-handed users is transparent to SWT and to your application.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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