SetMouseX
SetMouseX Xpos
 
Parameters:

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

      SetMouseX will position the windows mouse pointer along the X axis



FACTS:


      * When a program is running in windowed screen mode, the mouse now expect coordinates relevant to the windows desk top. So in order to reposition the mouse over your window correctly, you'll need to offset by the screens current position. See GetScreenXpos().




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=GetScreenYpos()
        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: MouseMoveY | MouseMoveZ | MouseX | MouseY | MouseZ | SetMouse | SetMouseY :
 


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