FutureBasic Logo

<<    Index    >> FutureBasic 5

mouse <position>   function

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

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).

window 1
print "Move the mouse around. Press Cmd-period to quit."
  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

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

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