Amos Professional Manual  Contents  Index

the Joystick and Mouse


Limiting the mouse pointer
One of the commonest screen conventions for both leisure and serious programs is the use of control panels. AMOS Professional relies on them extensively for ease of use and clarity. Supposing you need to set up a control panel on your screen, but you want to prevent the mouse pointer from wandering outside the area of that panel.

LIMIT MOUSE
instruction: limit mouse pointer to part of the screen
Limit Mouse x1 ,y1 To x2,y2
Limit Mouse

This command sets up a rectangular area for the mouse pointer to move around, and traps it inside the boundaries ,set by hardware coordinates, from the rectangle's top-left TO bottom right-hand corner. For example:

E> Limit Mouse 300,100 To 350,150

If you need to restore freedom to the mouse pointer and allow it to move around the entire screen, use the LIMIT MOUSE instruction on its own, without any coordinates after it. Note that SCREEN OPEN must be followed by a WAIT VBL command before LIMIT MOUSE can be used, otherwise no screen will be set up for screen limits to be set.

Finding the mouse pointer
If you already understand the concept of different screens and screen zone numbers, you will appreciate that it is not difficult to lose track of the mouse pointer.

You may need to keep a check on various screens and screen zones in order to keep in control of the mouse pointer. If you do not already understand the concept of different screens and screen zone numbers, you will need to become familiar with the various SCREEN commands and ZONE functions.

MOUSE ZONE
function: check if the mouse pointer is in a zone
zone number=Mouse Zone


The MOUSE ZONE function checks to see where the mouse pointer is currently located, and if it has entered a screen zone, the number of that zone is returned. It is equivalent to the following line:

X> X=Hzone(X Mouse,Y Mouse)

MOUSE SCREEN
function: check which screen the mouse pointer is occupying
screen number=Mouse Screen

Back    Next
05.08.06