Syntax:
on mouse {fn userFunction|gosub{lineNumber|"stmtLabel"}}
Description:
This statement designates a particular function or subroutine as a mouse-event handling routine. A mouse-event handling routine is called in response to a mouseclick which occurs inside the content region of the currently active window (but not inside any buttons, scrollbars, edit fields nor picture fields).
After such a mouseclick occurs, FutureBasic does not call your designated routine immediately. Instead, your program continues executing until a HandleEvents
statement is reached. At that time, HandleEvents
will call your designated routine once for each mouseclick event that occurred; your designated routine should examine the mouse <event>
functions to get information about the event.
Note:
If you use the on mouse fn userFunction
syntax, then userFunction
must refer to a function which was defined or prototyped at an earlier location in the source code. Your mouse-event handling function should not take any parameters, nor return a result.
If your program does not use HandleEvents
, you can use the mouse(_down)
, mouse(_lastMVert)
, mouse(_lastMHorz)
and many other position functions (outlined in the FutureBasic Mouse Group of the constants document) to track mouse activity.
See Also:
mouse <event>; mouse(_down); mouse <position>; HandleEvents