mirror of
https://github.com/QB64-Phoenix-Edition/QB64pe.git
synced 2024-09-16 12:04:06 +00:00
aeb9c0668b
Note: Many files were removed (not yet existing/empty pages). The parser will try to download them on demand and will auto-generate text for missing pages (eg. most _gl pages).
45 lines
1.4 KiB
Text
45 lines
1.4 KiB
Text
{{QBDLDATE:05-20-2022}}
|
|
{{QBDLTIME:23:11:39}}
|
|
{{DISPLAYTITLE:_WINDOWHASFOCUS}}
|
|
The [[_WINDOWHASFOCUS]] function returns true (-1) if the current program's window has focus. Windows-only.
|
|
|
|
|
|
{{PageSyntax}}
|
|
: {{Parameter|hasFocus%%}} = [[_WINDOWHASFOCUS]]
|
|
|
|
|
|
{{PageDescription}}
|
|
* The function returns true (-1) if the current program is the topmost window on the user's desktop and has focus. If the current program is running behind another window, the function returns false (0).
|
|
* [[Keywords_currently_not_supported_by_QB64#Keywords_Not_Supported_in_Linux_or_MAC_OSX_versions|Not available in macOS]].
|
|
|
|
|
|
==Availability==
|
|
* '''Build 20170924/68'''.
|
|
|
|
|
|
{{PageExamples}}
|
|
''Example:'' Detecting if the current program has focus. Windows and Linux-only.
|
|
{{CodeStart}}
|
|
DO
|
|
{{Cl|IF}} {{Cl|_WINDOWHASFOCUS}} THEN
|
|
{{Cl|COLOR}} 15, 6
|
|
{{Cl|CLS}}
|
|
{{Cl|PRINT}} "*** Hi there! ***"
|
|
{{Cl|ELSE}}
|
|
{{Cl|COLOR}} 0, 7
|
|
CLS
|
|
PRINT "(ain't nobody looking...)"
|
|
{{Cl|END IF}}
|
|
{{Cl|_DISPLAY}}
|
|
{{Cl|_LIMIT}} 30
|
|
{{Cl|LOOP}}
|
|
{{CodeEnd}}
|
|
: ''Explanation:'' The program will display ''"*** Hi There! ***"'' while the window is the topmost and is being manipulated by the user. If another window, the taskbar or the desktop are clicked, the program window loses focus and the message ''"(ain't nobody looking...)"'' is displayed.
|
|
|
|
|
|
{{PageSeeAlso}}
|
|
* [[_SCREENEXISTS]]
|
|
|
|
|
|
{{PageNavigation}}
|
|
|