SetMouse
 
Sets the position and visibility of the mouse cursor

Syntax

Declare Function SetMouse ( ByVal x As Integer = -1, ByVal y As Integer = -1, ByVal visibility As Integer = -1, ByVal clip As Integer = -1 ) As Integer

Usage

result = SetMouse([ x ] [, [ y ] [, [ visibility ] [, [ clip ]]]])

Parameters

x
optional - set x coordinate
y
optional - set y coordinate
visibility
optional - set visibility: 1 indicates visible, 0 indicates hidden
clip
optional - set clipping: 1 indicates mouse is clipped to graphics window, 0 indicates no clipping

Return Value

0 on success, non-zero to indicate failure.

Description

SetMouse will set the X,Y coordinates of the mouse pointer, as well as setting it's visibility. Mouse position is set using the X and Y parameters. The mouse will be visible if visibility is set to 1, and invisible if visibility is set to 0. SetMouse is intended for graphics modes initiated using the Screen (Graphics) statement only.

Example

#include "fbgfx.bi"
Dim x As Integer, y As Integer, buttons As Integer

' create a screen 800x600, 32-bit color, 1 video page
Screen 19, 32, 1                         

Do
    ' get mouse x, y and button state
    GetMouse x, y , , buttons                     

    If buttons = 1 Then
        ' on left mouse click, center mouse
        SetMouse 400, 300
    End If

    ' do loop until esc is pressed
Loop Until MultiKey(fb.SC_ESCAPE)                             



Dialect Differences

  • Not available in the -lang qb dialect unless referenced with the alias __Setmouse.

Differences from QB

  • New to FreeBASIC

See also