Mouse Capture Demonstration
This sample demonstrates the use of the setCapture and releaseCapture methods to give a floating menu control of the mouse.
Left-click anywhere on the BODY (white background) to enable the menu.
Left-click anywhere on the BODY again to disable the menu.
Left-click on the "Do Something Else" button, on any of the bold text, or any of the links while the menu is open to see how the mouse events are checked.The setCapture and releaseCapture methods are used to provide mouse feedback while the menu is open.
When the menu is visible, the setCapture method is used to prevent clicking on other areas except the BODY, which is used to cancel the menu. While setCapture is enabled on the menu, the onmousemove event, and the clientX and clientY event properties are used to track the location of the mouse. Notice that the mouse movements are tracked even when the mouse is not over the menu.
© 1999 Microsoft Corporation. All rights reserved. Terms of use.