GetScreenFocus
State = GetScreenFocus()
 
Parameters: NONE
Returns:

    State = The current focus state of the PB screen (1= has focus, 0 = lost focus)
 

      The GetScreenFocus() function checks if the PlayBASIC screen has focus or not.



FACTS:


      * GetScreenFocus only works in windowed screen modes.

      * If your program has lost focus, it's a good idea to force your program to WAIT, so it doesn't hog the computers CPU too much.




Mini Tutorial:


      This example displays a message if the PB screen has focus or not.


  
  
  Do
   ; clear the screen to a greeny colour
     Cls RGB(0,100,40)
     
     
   ; Check if the PB screen currently has focus
     If GetScreenFocus()=true
        
      ; If the screen has focus then display this message
        Print "Your Program has focus"
        
     Else
      ; If the screen doesn't have focus then we
      ; display this message
        Print "Not In Focus"
        
      ; Tell PB to wait 100 milliseconds so it
      ; doesn't hog the CPU when your program
      ; is not in focus
        Wait 100
     EndIf
     
     
   ; Refresh the screen
     Sync
  Loop
  
  




This example would output when the screen has focus.

  
  Your Program has focus
  

 
Related Info: GetScreenType | OpenScreen | Wait :
 


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