FutureBasic Logo

<<    Index    >> FutureBasic 5

mouse <position>   function



Syntax:
horzPosition = mouse(_horz)
vertPosition = mouse(_vert)


Description:
If your program does not do any kind of event-trapping using the HandleEvents statement, then mouse(_horz) and mouse(_vert) return the mouse pointer's current horizontal and vertical pixel coordinates, relative to the upper-left corner of the current output window.
If your program does use HandleEvents, then the mouse <position> functions indicate where the mouse was the last time mouse(0) was accessed (see the mouse <event> functions).

Example:
window 1
print "Move the mouse around. Press Cmd-period to quit."
do
  HandleEvents
  dummy = mouse(0) 'To activate the mouse <position> fn's
  xNew = mouse(_horz): yNew = mouse(_vert)
  long if xNew <> xOld or yNew <> yOld
    locate 0,1: cls line
    print xNew, yNew
    xOld = xNew: yOld = yNew
  end if
until _false


Note:
Use the mouse <event> functions to determine the mouse's position at the instant it was clicked.

See Also:
mouse(_down); mouse <event>