MouseInBox
Result = MouseInBox(X1, Y1, X2, Y2)
 
Parameters:

    X1 = The top left hand X coordinate of the box
    Y1 = The top left hand Y coordinate of the box
    X2 = The bottom right hand X coordinate of the box
    Y2 = The bottom right hand Y coordinate of the box
Returns:

    Result = If mouse is inside this region it'll return 1, of not 0
 

      MouseInBox checks if the mouse cursor is within a given box. The function returns True (1) the mouse cursor is within the box, otherwise it returns False (0).



FACTS:


      * MouseInBox can be useful for creating user interfaces.




Mini Tutorial:


      Showing the use of MouseInBox

  
; Calculate Box position and dimension
  X1 = GetScreenWidth() / 2 - 20
  Y1 = GetScreenHeight() / 2 - 20
  X2 = X1 + 40
  Y2 = Y1 + 40
  
; White Color
  White = RGB(255,255,255)
  
; Red Colour
  Red = RGB(255,0,0)
  
  Repeat
     Cls RGB(0,0,0)
     
   ; Check if mouse is in box
     If MouseInBox(X1, Y1, X2, Y2)
      ; Draw a Box in red
        BoxC X1, Y1, X2, Y2, 1, Red
     Else
      ; Draw a Box in white
        BoxC X1, Y1, X2, Y2, 1, White
     EndIf
     Sync
  Until EscKey()
  
  


 
Related Info: LineIntersectCircle | LineIntersectRect | LinesIntersect | PointInBox | PointIntersectCircle :
 


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