


In graphical environments such as Windows, several applications may be running at the same time. How is the activity of moving the mouse pointer or clicking a mouse button communicated to the correct application?
Mouse actions are first communicated directly to the environment. The environment then determines which application receives a message about the mouse activity.
Almost always, the basic rule is that whichever application window is topmost and is sitting directly under the mouse pointer receives the current mouse message.
The graphical environment makes this determination on its own, which means that an ACUCOBOL-GT application is not aware of mouse actions that happen outside its application window. Conversely, mouse actions occurring within an ACUCOBOL-GT application window are not known to other applications that might be running at the same time.
The one exception to the basic rule of "who receives the mouse message" is that you can "capture" the mouse in your program by a subroutine call. If you "capture" the mouse, your program receives all mouse messages, no matter where they occur on the physical screen, until you "release" the mouse. (This option is typically used for situations where the user is marking or dragging some object on the screen. You can "capture" the mouse so that you can control the situation even if the user accidentally moves the mouse outside your application window. The specifics of mouse capturing are discussed later in this chapter.)