1.1 Basic elements and data structures
1.1.7 The mouse and mouse input streams The mouse is a two- or three-button accessory that you can use to control the window environment. Depressing a mouse button is called clicking the mouse. By moving the mouse, you cause a special mouse cursor to move on the screen. The Window Tool Kit monitors the status of the mouse by handling mouse events. Mouse events are structures that encode specific instances of mouse movement or mouse button activity and that can be passed as arguments to functions. All character input from the keyboard and any mouse event structures are relayed to the Window Tool Kit on a mouse input stream.
You can attach mouse documentation to an active region, which is a region of a bitmap in which mouse events cause an associated function to be executed. Whenever the mouse enters an active region that has mouse documentation attached, the documentation appears in the who window, which is a window at the bottom of the root viewport that displays information about the state of the mouse. The who window is managed by the who process, which updates and displays the documentation whenever necessary.
- There are three mouse events per button:
- When you press a button in the stream, you get a down event.
- If you hold the mouse button down and move the mouse some distance, you get a click event. When the mouse button comes up, you get an up event:
- Normally, you press a button down and then let it up; there is a short timeout before the click event occurs:
- If you press again simultaneously before the timeout, the click event is postponed:
Initially, the primary root viewport contains the who window. However, you can create a new who window at any location and can specify any root viewport, window, or viewport as its parent. Who window positions are relative to the specified parent window. You can even create a top-level who window that has no parent. Whenever you create a new who window, the old one is automatically removed; only one who window can be present in the system at any given time.
You can define certain characters as keyboard interrupt characters. When you type a keyboard interrupt character that is associated with a mouse input stream, the current operation is interrupted and a user-defined function is invoked. The character is not relayed to the stream, nor does it appear on any bitmap. For more information, see Chapter 6, "Keyboard Interrupt Characters".
Chapter 3, "The Mouse" presents more information about the mouse and mouse input streams.
The Window Tool Kit - 9 SEP 1996
Generated with Harlequin WebMaker