SetMouse
SetMouse Xpos, Ypos
 
Parameters:

    Xpos = The X coordinate of where you wish to locate the mouse pointer
    Ypos = The Y coordinate of where you wish to locate the mouse pointer
Returns: NONE
 

      SetMouse will position the windows mouse pointer.



FACTS:


      * When a program is running with a windowed screen mode, the mouse coordinates with be in the range of the size of the windows desk top and not the PlayBASIC window. So if you wish to reposition the mouse over your windowed screen, you'll need to read where the screen is located using the GetScreenXpos() and GetScreenYpos() commands. Then offset it from those.




Mini Tutorial:


      This example shows uses the SetMouse and SetMouseX and SetMouseY commands to randomly reposition the mouse pointer when certain keys are hit.


  
  Do
   ; Clear the screen to Black RGB(0,0,0)
     Cls RGB(0,0,0)
     
   ; Display a Message
     Print "Hit the Space Key To Randomly Set the Mouse POsition"
     
   ; When the Space bar is hit, the mouse will be
   ; randomly repositioned over the PlayBASIC window
     
     If SpaceKey()
        x=GetScreenXpos()
        y=GetScreenXpos()
        w=GetScreenWidth()
        h=GetScreenHeight()
        SetMouse x+Rnd(w),y+Rnd(h)
     EndIf
     
   ; When the X or Y keys are hit, the mouse will
   ; be randomly repositioned over the Play Basic
   ; window, on either the X or Y axis
     
     k$=Inkey$()
     Print "Hit the X key To Randomly Set the Mouses X Position"
     If k$="x"
        SetMouseX GetScreenXpos()+Rnd(GetScreenWidth())
     EndIf
     
     Print "Hit the Y key To Randomly Set the Mouses Y Position"
     If k$="y"
        SetMouseY GetScreenYpos()+Rnd(GetScreenHeight())
     EndIf
     
   ; Show The SCreen and Loop back to the Do statement
     Sync
  Loop
  




 
Related Info: MouseButton | MouseMoveX | MouseMoveY | MouseMoveZ | MouseX | MouseY | MouseZ | SetMouseX | SetMouseY :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com