Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- GetIt Reference Guide - syntax: n_onmouse([<procedurec>]) http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Syntax: N_ONMOUSE([<procedureC>])

Calls user defined procedure when a key is pressed on the mouse device.

N_ONMOUSE() with no parameters returns the current mouse location.

Example

STORE SPACE(20) to lastname,firstname
@ 1,0 SAY "Last Name:"
N_ONMOUSE("mouse_hit")
  ...
PROCEDURE mouse_hit
status = N_ONMOUSE()
row = int(CH_ASC2(status,1) / 8)
col = int(CH_ASC2(status,3) / 8)
getno = N_SFIELD(row,col)
IF getno > 0
  @ 24,0 "Mouse is positioned on field:" + N_GETVAR(getno)
ENDIF
RETURN

Notes

N_ONMOUSE detects only when a key is pressed/released on the mouse device.
Mouse movement is not detected.

N_ONMOUSE() with no paratmeters returns a seven byte status code with
three numbers stored as LH integers.  Use the NetLib CH_ASC2 function
to obtain the numeric values from the LH integers.

     Bytes
       1-2     Current mouse vertical position as LH integer.
       3-4     Current mouse horizontal position as LH integer.
       5       'L' = Left key depressed.
       6       'R' = Right key depressed.
       7       'M' = Middle key depressed.

To convert pixels to an actual column/row, you must know the number of
vertical and horizontal "mickeys" on the screen.  In the above example,
using a standard VGA it is 192 by 632, which means that dividing the
"mickeys" by 8 will yield the approximate row, column position.  To
determine the measurements of your screen, remember that at start-up
the mouse is assumed to be positioned at the center of the screen.  You
can use the following three line program to get the exact measurements:

   status = N_ONMOUSE()
   ? "Horizontal Mickeys:", CH_ASC2(status,1) * 2
   ? "Veritcal Mickeys  :", CH_ASC2(status,3) * 2

N_ONMOUSE is intended to augment, not replace, a comprehensive mouse library
like Funcky or ProClip.

To trap on other mouse events besides a key press, use N_ONTICK to sample
the mouse on a constant basis.

IMPORTANT: The first call to N_ONMOUSE checks to see whether the mouse
driver is installed.  This may affect settings you have already made to the
mouse driver with a library like Funcky or ProClip.  Thus, you should issue
N_ONMOUSE() with no parameters at the start of the program before
configuring the mouse attributes.

See Also: N_SFIELD

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson