Sams Teach Yourself Visual Basic 6 in 24 Hours

Sams Teach Yourself Visual Basic 6 in 24 Hours

By Greg Perry

The Mouse and Hotkeys Need No Focus

As stated earlier, a mouse click doesn't have to worry about focus. Wherever the user clicks, the mouse gets the mouse click no matter which window and control had the focus before the click. In addition, within the active window, the user can select any control by pressing that control's hotkey. For example, with Figure 4.2 showing, the user could press Alt+X to select the Text Box command button even though the Images command button has the focus.

An Enter keypress has no inherent location. Without focus, Windows would have no way to determine where or what the Enter keypress is supposed to activate. With a hotkey, Windows keeps the hotkey possibility within the window with the focus. In other words, if two windows appear on your screen and both contain controls with Alt+S keystrokes, only the active window with the current focus would receive and respond to Alt+S.

The mouse is inherently directional as well as functional. When you click the mouse button over any window's control on the screen, Windows knows for certain that you wanted to click over that control. No ambiguity can exist as could happen with the Enter key. Therefore, focus doesn't apply to the mouse.

Share ThisShare This

Informit Network