Controlling the Mouse CursorThe mouse cursor indicates the current position of the mouse (by default, the cursor is a small white arrow, but it changes shapes in specific contexts). The fg_mousevis() function defines the cursor visibility. Passing 0 to fg_mousevis() makes the mouse cursor invisible, while passing 1 makes the cursor visible. If the mouse cursor is already in the requested state, fg_mousevis() does nothing. Moving the mouse of course changes the cursor position, but you also can position the mouse cursor with fg_mousemov(). This function has two parameters that specify the new horizontal and vertical cursor position. The position is expressed in screen space units for the active virtual buffer and is automatically translated to the corresponding client coordinates. For example,
C/C++:
Delphi:
Visual Basic:
references the middle of the active virtual buffer, so fg_mousemov() will move the cursor to the middle of the client area. If you want to move the mouse to an exact client position, you can use the fg_xvb() and fg_yvb() functions to translate client coordinates to virtual buffer units. The fg_mousemov() function moves the cursor whether or not it is visible. Sometimes it is useful to restrict the mouse cursor to a specific area of the screen. The fg_mouselim() function prevents the mouse cursor from moving outside the specified rectangular area. It requires four parameters that specify the minimum horizontal coordinate, maximum horizontal coordinate, minimum vertical coordinate, and maximum vertical coordinate of this area. Again, the coordinates are expressed in screen space units for the active virtual buffer and are automatically translated to the corresponding client coordinates. For example,
C/C++:
Delphi:
Visual Basic:
prevents the mouse cursor from moving outside the client area. Calling fg_mouselim() with a maximum x coordinate that is less than the minimum x coordinate, or with a maximum y coordinate that is less than the minimum y coordinate, restores full screen cursor movement. You should do this in the WM_DESTROY message handler if you use fg_mouselim() elsewhere in the program.
|
 
copyright 2001 Ted Gruber Software, Inc.