mirror of
https://github.com/DualBrain/QB64.git
synced 2023-11-19 13:10:13 +00:00
Removed _TOGGLEBIT through _WINDOWHASFOCUS
This commit is contained in:
parent
072c3477d5
commit
d52a2a745f
|
@ -1,50 +0,0 @@
|
|||
The [_TOGGLEBIT](_TOGGLEBIT) function is used to toggle a specified bit of a numerical value.
|
||||
|
||||
## Syntax
|
||||
|
||||
> result = [_TOGGLEBIT](_TOGGLEBIT)(numericalVariable, numericalValue)
|
||||
|
||||
## Parameter(s)
|
||||
|
||||
* numericalVariable is the variable to toggle the bit of and can be of the following types: [_BYTE](_BYTE), [INTEGER](INTEGER), [LONG](LONG), or [_INTEGER64](_INTEGER64).
|
||||
* Integer values can be signed or [_UNSIGNED](_UNSIGNED).
|
||||
* numericalValue the number of the bit to be set.
|
||||
|
||||
## Description
|
||||
|
||||
* Can be used to manually manipulate individual bits of an integer value by toggling their state.
|
||||
* A bit set to 1 is changed to 0 and a bit set to 0 is changed to 1.
|
||||
* Bits start at 0 (so a [_BYTE](_BYTE) has bits 0 to 7, [INTEGER](INTEGER) 0 to 15, and so on)
|
||||
|
||||
## Availability
|
||||
|
||||
* Version 1.4 and up.
|
||||
|
||||
## Example(s)
|
||||
|
||||
*Example 1:*
|
||||
|
||||
```vb
|
||||
|
||||
A~%% = 0 '_UNSIGNED _BYTE
|
||||
PRINT A~%%
|
||||
A~%% = _TOGGLEBIT(A~%%,4) 'toggle the fourth bit of A~%%
|
||||
PRINT A~%%
|
||||
A~%% = _TOGGLEBIT(A~%%,4) 'toggle the fourth bit of A~%%
|
||||
PRINT A~%%
|
||||
|
||||
```
|
||||
|
||||
```text
|
||||
|
||||
0
|
||||
16
|
||||
0
|
||||
|
||||
```
|
||||
|
||||
## See Also
|
||||
|
||||
* [_SHL](_SHL), [_SHR](_SHR), [INTEGER](INTEGER), [LONG](LONG)
|
||||
* [_SETBIT](_SETBIT), [_BYTE](_BYTE), [_INTEGER64](_INTEGER64)
|
||||
* [_RESETBIT](_RESETBIT), [_READBIT](_READBIT)
|
|
@ -1,26 +0,0 @@
|
|||
The [_TOTALDROPPEDFILES](_TOTALDROPPEDFILES) function returns the number of items (files or folders) dropped in a program's window after [_ACCEPTFILEDROP](_ACCEPTFILEDROP) is enabled.
|
||||
|
||||
## Syntax
|
||||
|
||||
> totalFilesReceived& = [_TOTALDROPPEDFILES](_TOTALDROPPEDFILES)
|
||||
|
||||
## Description
|
||||
|
||||
* After [_ACCEPTFILEDROP](_ACCEPTFILEDROP) is enabled, [_TOTALDROPPEDFILES](_TOTALDROPPEDFILES) will return 0 until the user drops files or folders into the program's window.
|
||||
* When using [_DROPPEDFILE](_DROPPEDFILE) to read the list sequentially, [_TOTALDROPPEDFILES](_TOTALDROPPEDFILES) will be reset to 0 after the last item is retrieved (after [_DROPPEDFILE](_DROPPEDFILE) returns an empty string "").
|
||||
* If using [_DROPPEDFILE](_DROPPEDFILE) with an index, you must call [_FINISHDROP](_FINISHDROP) after you finish working with the list.
|
||||
* When using [_DROPPEDFILE](_DROPPEDFILE) to read the list with an index, [_TOTALDROPPEDFILES](_TOTALDROPPEDFILES) will **not** be reset (and the list of items won't be cleared) until [_FINISHDROP](_FINISHDROP) is called.
|
||||
* **[Keywords currently not supported](Keywords-currently-not-supported-by-QB64)**.
|
||||
|
||||
## Availability
|
||||
|
||||
* Version 1.3 and up.
|
||||
|
||||
## Example(s)
|
||||
|
||||
* See example for [_ACCEPTFILEDROP](_ACCEPTFILEDROP)
|
||||
|
||||
## See Also
|
||||
|
||||
* [_ACCEPTFILEDROP](_ACCEPTFILEDROP), [_DROPPEDFILE](_DROPPEDFILE), [_FINISHDROP](_FINISHDROP)
|
||||
* [_FILEEXISTS](_FILEEXISTS), [_DIREXISTS](_DIREXISTS)
|
|
@ -1,41 +0,0 @@
|
|||
The [_TRIM$](_TRIM$) function removes both leading and trailing space characters from a [STRING](STRING) value.
|
||||
|
||||
## Syntax
|
||||
|
||||
> return$ = [_TRIM$](_TRIM$)(text$)
|
||||
|
||||
## Description
|
||||
|
||||
* Shorthand to using [LTRIM$](LTRIM$)([RTRIM$](RTRIM$)("text"))
|
||||
* text$ is the [STRING](STRING) value to trim.
|
||||
* If text$ contains no leading or trailing space characters, it is returned unchanged.
|
||||
* Convert fixed length [STRING](STRING) values by using a different return$ variable.
|
||||
|
||||
## Example(s)
|
||||
|
||||
Demonstrating how _TRIM$(text$) can replace LTRIM$(RTRIM$(text$)):
|
||||
|
||||
```vb
|
||||
|
||||
text$ = SPACE$(10) + "some text" + SPACE$(10)
|
||||
PRINT "[" + text$ + "]"
|
||||
PRINT "[" + RTRIM$(text$) + "]"
|
||||
PRINT "[" + LTRIM$(text$) + "]"
|
||||
PRINT "[" + LTRIM$(RTRIM$(text$)) + "]"
|
||||
PRINT "[" + _TRIM$(text$) + "]"
|
||||
|
||||
```
|
||||
|
||||
```text
|
||||
|
||||
[ some text ]
|
||||
[ some text]
|
||||
[some text ]
|
||||
[some text]
|
||||
[some text]
|
||||
|
||||
```
|
||||
|
||||
## See Also
|
||||
|
||||
* [RTRIM$](RTRIM$), [LTRIM$](LTRIM$)
|
|
@ -1,105 +0,0 @@
|
|||
[_UNSIGNED]([_UNSIGNED](_UNSIGNED) defines a numerical value as being only positive.
|
||||
|
||||
## Syntax
|
||||
|
||||
> [DIM](DIM) variable [AS](AS) [[_UNSIGNED](_UNSIGNED)] datatype
|
||||
|
||||
> [_DEFINE](_DEFINE) letterRange [AS](AS) [[_UNSIGNED](_UNSIGNED)] datatype
|
||||
|
||||
## Description
|
||||
|
||||
* Datatype can be any of the following: [INTEGER](INTEGER), [LONG](LONG), [_BIT](_BIT), [_BYTE](_BYTE), [_INTEGER64](_INTEGER64), [_OFFSET](_OFFSET)
|
||||
***[SINGLE](SINGLE), [DOUBLE](DOUBLE) and [_FLOAT](_FLOAT) variable types cannot be [_UNSIGNED](_UNSIGNED).**
|
||||
* [_UNSIGNED](_UNSIGNED) can be used in a [_DEFINE](_DEFINE) statement to set undefined variable name first letters as all positive-only values.
|
||||
* Can also be used in [DIM](DIM) statements or subprocedure parameter definitions following [AS](AS).
|
||||
* [_UNSIGNED](_UNSIGNED) allows larger positive numerical variable value limits than signed ones.
|
||||
* The unsigned variable type suffix used is the **tilde (~)**, right before the number's own type suffix: variableName~&
|
||||
|
||||
How negative values affect the [_UNSIGNED](_UNSIGNED) value returned by a [_BYTE](_BYTE) (8 bits).
|
||||
|
||||
```text
|
||||
|
||||
|
||||
00000001 - unsigned & signed are both 1
|
||||
01111111 - unsigned & signed are both 127
|
||||
11111111 - unsigned is 255 but signed is -1
|
||||
11111110 - unsigned is 254 but signed is -2
|
||||
11111101 - unsigned is 253 but signed is -3
|
||||
|
||||
```
|
||||
|
||||
## Example(s)
|
||||
|
||||
In **QB64**, when a signed [INTEGER](INTEGER) value exceeds 32767, the value may become a negative value:
|
||||
|
||||
```vb
|
||||
|
||||
i% = 38000
|
||||
PRINT i%
|
||||
|
||||
```
|
||||
|
||||
```text
|
||||
|
||||
-27536
|
||||
|
||||
```
|
||||
|
||||
> *Explanation:* Use an [_UNSIGNED](_UNSIGNED) [INTEGER](INTEGER) or a ~% variable type suffix for only positive integer values up to 65535.
|
||||
|
||||
In **QB64**, [_UNSIGNED](_UNSIGNED) [INTEGER](INTEGER) values greater than 65535 cycle over again from zero:
|
||||
|
||||
```vb
|
||||
|
||||
i~% = 70000
|
||||
PRINT i~%
|
||||
|
||||
```
|
||||
|
||||
```text
|
||||
|
||||
4464
|
||||
|
||||
```
|
||||
|
||||
> *Explanation:* In QB64 an unsigned integer value of 65536 would be 0 with values increasing by the value minus 65536.
|
||||
|
||||
Demonstrating how _UNSIGNED variables expand the [INTEGER](INTEGER) range.
|
||||
|
||||
```vb
|
||||
|
||||
DIM n AS _UNSIGNED INTEGER
|
||||
DIM pn AS _UNSIGNED INTEGER
|
||||
LOCATE 3, 6: PRINT "Press Esc to exit loop"
|
||||
FOR n = 1 TO 80000
|
||||
_LIMIT 10000 ' 6.5 second loop
|
||||
LOCATE 12, 37: PRINT n ' display current value
|
||||
IF n > 0 THEN pn = n ' find highest value
|
||||
IF n = 0 THEN Count = Count + 1: LOCATE 14, 37: PRINT "Count:"; Count; "Max:"; pn
|
||||
IF INP(&H60) = 1 THEN EXIT FOR ' escape key exit
|
||||
NEXT n
|
||||
END
|
||||
|
||||
```
|
||||
|
||||
```text
|
||||
|
||||
Press Esc to exit loop
|
||||
|
||||
65462
|
||||
|
||||
Count: 13 Max: 65535
|
||||
|
||||
|
||||
```
|
||||
|
||||
*Explanation:* The maximum value can only be 65535 (32767 + 32768) so the FOR loop repeats itself. Remove the [_UNSIGNED](_UNSIGNED) parts and run it again.
|
||||
|
||||
## See Also
|
||||
|
||||
* DECLARE, [SUB](SUB), [FUNCTION](FUNCTION)
|
||||
* [DIM](DIM), [_DEFINE](_DEFINE)
|
||||
* [DEFSTR](DEFSTR), [DEFLNG](DEFLNG), [DEFINT](DEFINT), [DEFSNG](DEFSNG), [DEFDBL](DEFDBL)
|
||||
* [INTEGER](INTEGER), [LONG](LONG), [_INTEGER64](_INTEGER64)
|
||||
* [ABS](ABS), [SGN](SGN)
|
||||
* [Variable Types](Variable-Types)
|
|
@ -1,72 +0,0 @@
|
|||
The [_WHEEL](_WHEEL) function returns the relative position of a specified wheel number on a controller device.
|
||||
|
||||
## Syntax
|
||||
|
||||
> move = [_WHEEL](_WHEEL)(wheelNumber%)
|
||||
|
||||
* Returns -1 when scrolling up and 1 when scrolling down with 0 indicating no movement since last read.
|
||||
* Add consecutive wheel values to determine a cumulative value over time for scrolling or moving objects.
|
||||
* wheelNumber% must be a number which does not exceed the number of wheels found by the [_LASTWHEEL](_LASTWHEEL) function.
|
||||
* When a mouse indicates it has 3 wheels, the first two are for relative movement reads. The third wheel is for scrolling.
|
||||
* **The number of [_DEVICES](_DEVICES) must be read before using [_DEVICE$](_DEVICE$), [_DEVICEINPUT](_DEVICEINPUT) or [_LASTWHEEL](_LASTWHEEL).**
|
||||
|
||||
## Example(s)
|
||||
|
||||
Reading multiple controller device buttons, axis and wheels.
|
||||
|
||||
```vb
|
||||
|
||||
FOR i = 1 TO _DEVICES
|
||||
PRINT STR$(i) + ") " + _DEVICE$(i) + " Buttons:"; _LASTBUTTON(i); ",Axis:"; _LASTAXIS(i); ",Wheel:"; _LASTWHEEL(i)
|
||||
NEXT
|
||||
|
||||
DO
|
||||
d& = _DEVICEINPUT
|
||||
IF d& THEN ' the device number cannot be zero!
|
||||
PRINT "Found"; d&;
|
||||
FOR b = 1 TO _LASTBUTTON(d&)
|
||||
PRINT _BUTTONCHANGE(b); _BUTTON(b);
|
||||
NEXT
|
||||
FOR a = 1 TO _LASTAXIS(d&)
|
||||
PRINT _AXIS(a);
|
||||
NEXT
|
||||
FOR w = 1 TO _LASTWHEEL(d&)
|
||||
PRINT _WHEEL(w);
|
||||
NEXT
|
||||
PRINT
|
||||
END IF
|
||||
LOOP UNTIL INKEY$ = CHR$(27) 'escape key exit
|
||||
|
||||
END
|
||||
|
||||
```
|
||||
|
||||
> *Note:* When there is no device control to read, a [FOR...NEXT](FOR...NEXT) n = 1 TO 0 loop will not run thus avoiding a control function read error.
|
||||
|
||||
Why does a mouse have 3 wheels? Relative x and y movements can be read using the first 2 _WHEEL reads.
|
||||
|
||||
```vb
|
||||
|
||||
ignore = _MOUSEMOVEMENTX 'dummy call to put mouse into relative movement mode
|
||||
|
||||
PRINT "Move your mouse and/or your mouse wheel (ESC to exit)"
|
||||
|
||||
d = _DEVICES ' always read number of devices to enable device input
|
||||
DO: _LIMIT 30 'main loop
|
||||
DO WHILE _DEVICEINPUT(2) 'loop only runs during a device 2 mouse event
|
||||
PRINT _WHEEL(1), _WHEEL(2), _WHEEL(3)
|
||||
LOOP
|
||||
LOOP UNTIL INKEY$ = CHR$(27)
|
||||
|
||||
```
|
||||
|
||||
> *Explanation:* Referencing the [_MOUSEMOVEMENTX](_MOUSEMOVEMENTX) function hides the mouse and sets the mouse to a relative movement mode which can be read by [_WHEEL](_WHEEL). [_DEVICEINPUT](_DEVICEINPUT)(2) returns -1 (true) only when the mouse is moved, scrolled or clicked.
|
||||
|
||||
## See Also
|
||||
|
||||
* [_MOUSEWHEEL](_MOUSEWHEEL)
|
||||
* [_LASTWHEEL](_LASTWHEEL), [_LASTBUTTON](_LASTBUTTON), [_LASTAXIS](_LASTAXIS)
|
||||
* [_AXIS](_AXIS), [_BUTTON](_BUTTON), [_BUTTONCHANGE](_BUTTONCHANGE)
|
||||
* [_DEVICES](_DEVICES), [_DEVICE$](_DEVICE$), [_DEVICEINPUT](_DEVICEINPUT)
|
||||
* [_MOUSEMOVEMENTX](_MOUSEMOVEMENTX), [_MOUSEMOVEMENTY](_MOUSEMOVEMENTY)
|
||||
* [Controller Devices](Controller-Devices)
|
|
@ -1,43 +0,0 @@
|
|||
The [_WIDTH (function)](_WIDTH-(function)) function returns the width of an image handle or of the current write page.
|
||||
|
||||
## Syntax
|
||||
|
||||
> columns& = [_WIDTH](_WIDTH-(function))[(imageHandle&)]
|
||||
|
||||
## Description
|
||||
|
||||
* If imageHandle& is omitted, it's assumed to be the handle of the current [SCREEN](SCREEN) or write page.
|
||||
* To get the width of the current program [SCREEN](SCREEN) window use zero for the handle value or nothing: columns& = [_WIDTH (function)](_WIDTH-(function))(0) *or* columns& = [_WIDTH (function)](_WIDTH-(function))
|
||||
* If the image specified by imageHandle& is in text only([SCREEN](SCREEN) 0) mode, the number of characters per row is returned.
|
||||
* If the image specified by imageHandle& is in graphics mode, the number of pixels per row is returned.
|
||||
* If imageHandle& is an invalid handle, then an [ERROR Codes](ERROR-Codes) is returned.
|
||||
* The last visible pixel coordinate of a program [SCREEN](SCREEN) is **[_WIDTH (function)](_WIDTH-(function)) - 1**.
|
||||
|
||||
## Example(s)
|
||||
|
||||
A SUB program that centers text in any graphic screen mode except text mode [SCREEN (statement)](SCREEN-(statement)) 0.
|
||||
|
||||
```vb
|
||||
|
||||
s& = _NEWIMAGE(800, 600, 256)
|
||||
SCREEN s&
|
||||
Align 15, 5, s&, "This text is centered on the screen!"
|
||||
|
||||
SUB Align (Tcolor, Trow, mode&, txt$)
|
||||
center& = _WIDTH (mode&) \ 2 'returns pixels in graphic modes
|
||||
MaxCol = (center& \ 8) + 1 'screen text width = 8 pixels
|
||||
Tcol = MaxCol - (LEN(txt$) \ 2)
|
||||
COLOR Tcolor: LOCATE Trow, Tcol: PRINT txt$;
|
||||
END SUB
|
||||
|
||||
```
|
||||
|
||||
> *Explanation:* [_NEWIMAGE](_NEWIMAGE) enlarges a screen to 800 pixels wide which is what [_WIDTH (function)](_WIDTH-(function)) function will return. The center is 800 \ 2 or 400. Since the text width is 8 pixels, that is divided by 8 to get 50 as the center text column. Then half of the text length is subtracted to find the starting text print [LOCATE](LOCATE) column.
|
||||
|
||||
> *Note:* The screen handle parameter is required because using no handle could assume other page handles created by functions like [_NEWIMAGE](_NEWIMAGE) or [_PUTIMAGE](_PUTIMAGE). Use the correct handle in the SUB call! When using SCREEN 0, the MaxCol variable is not needed because _WIDTH returns the number of text columns, not pixels. Use the center value and add 1. **Tcol = (center& + 1) - LEN(txt$) \ 2**
|
||||
|
||||
## See Also
|
||||
|
||||
* [_HEIGHT](_HEIGHT), [_LOADIMAGE](_LOADIMAGE), [_NEWIMAGE](_NEWIMAGE)
|
||||
* [WIDTH](WIDTH)
|
||||
* [Bitmaps](Bitmaps)
|
|
@ -1,97 +0,0 @@
|
|||
The [_WINDOWHANDLE](_WINDOWHANDLE) function returns the window handle assigned to the current program by the OS. Windows-only.
|
||||
|
||||
## Syntax
|
||||
|
||||
> hwnd%& = [_WINDOWHANDLE](_WINDOWHANDLE)
|
||||
|
||||
## Description
|
||||
|
||||
* The result is an [_OFFSET](_OFFSET) number assigned by Windows to your running program.
|
||||
* Use it to make [Windows Libraries](Windows-Libraries) that require a window handle to be passed.
|
||||
* [Keywords currently not supported](Keywords-currently-not-supported-by-QB64).
|
||||
|
||||
## Availability
|
||||
|
||||
* Build 20170924/68 and up.
|
||||
|
||||
## Example(s)
|
||||
|
||||
Showing the system-default message box in Windows.
|
||||
|
||||
```vb
|
||||
|
||||
'Message Box Constant values as defined by Microsoft (MBType)
|
||||
CONST MB_OK& = 0 'OK button only
|
||||
CONST MB_OKCANCEL& = 1 'OK & Cancel
|
||||
CONST MB_ABORTRETRYIGNORE& = 2 'Abort, Retry & Ignore
|
||||
CONST MB_YESNOCANCEL& = 3 'Yes, No & Cancel
|
||||
CONST MB_YESNO& = 4 'Yes & No
|
||||
CONST MB_RETRYCANCEL& = 5 'Retry & Cancel
|
||||
CONST MB_CANCELTRYCONTINUE& = 6 'Cancel, Try Again & Continue
|
||||
CONST MB_ICONSTOP& = 16 'Error stop sign icon
|
||||
CONST MB_ICONQUESTION& = 32 'Question-mark icon
|
||||
CONST MB_ICONEXCLAMATION& = 48 'Exclamation-point icon
|
||||
CONST MB_ICONINFORMATION& = 64 'Letter i in a circle icon
|
||||
CONST MB_DEFBUTTON1& = 0 '1st button default(left)
|
||||
CONST MB_DEFBUTTON2& = 256 '2nd button default
|
||||
CONST MB_DEFBUTTON3& = 512 '3rd button default(right)
|
||||
CONST MB_APPLMODAL& = 0 'Message box applies to application only
|
||||
CONST MB_SYSTEMMODAL& = 4096 'Message box on top of all other windows
|
||||
CONST MB_SETFOCUS& = 65536 'Set message box as focus
|
||||
CONST IDOK& = 1 'OK button pressed
|
||||
CONST IDCANCEL& = 2 'Cancel button pressed
|
||||
CONST IDABORT& = 3 'Abort button pressed
|
||||
CONST IDRETRY& = 4 'Retry button pressed
|
||||
CONST IDIGNORE& = 5 'Ignore button pressed
|
||||
CONST IDYES& = 6 'Yes button pressed
|
||||
CONST IDNO& = 7 'No button pressed
|
||||
CONST IDTRYAGAIN& = 10 'Try again button pressed
|
||||
CONST IDCONTINUE& = 1 'Continue button pressed
|
||||
'----------------------------------------------------------------------------------------
|
||||
|
||||
DECLARE DYNAMIC LIBRARY "user32"
|
||||
FUNCTION MessageBoxA& (BYVAL hwnd AS _OFFSET, Message AS STRING, Title AS STRING, BYVAL MBType AS _UNSIGNED LONG)
|
||||
END DECLARE
|
||||
|
||||
DO
|
||||
msg& = 0: icon& = 0: DB& = 0
|
||||
INPUT "Enter Message Box type(0 to 6 other Quits): ", BOX&
|
||||
IF BOX& < 0 OR BOX& > 6 THEN EXIT DO
|
||||
|
||||
INPUT "Enter Icon&(0=none, 1=stop, 2=?, 3=!, 4=info): ", Icon&
|
||||
|
||||
IF BOX& THEN INPUT "Enter Default Button(1st, 2nd or 3rd): ", DB&
|
||||
IF DB& THEN DB& = DB& - 1 'adjust value to 0, 1, or 2
|
||||
msg& = MsgBox&("Box Title", "Box text message", BOX&, Icon&, DB&, 4096) 'on top of all windows
|
||||
|
||||
PRINT "Button ="; msg&
|
||||
LOOP
|
||||
END
|
||||
|
||||
FUNCTION MsgBox& (Title$, Message$, BoxType&, Icon&, DBtn&, Mode&)
|
||||
SELECT CASE Icon&
|
||||
CASE 1: Icon& = MB_ICONSTOP& 'warning X-sign icon
|
||||
CASE 2: Icon& = MB_ICONQUESTION& 'question-mark icon
|
||||
CASE 3: Icon& = MB_ICONEXCLAMATION& 'exclamation-point icon
|
||||
CASE 4: Icon& = MB_ICONINFORMATION& 'lowercase letter i in circle
|
||||
CASE ELSE: Icon& = 0 'no icon
|
||||
END SELECT
|
||||
IF BoxType& > 0 AND DBtn& > 0 THEN 'set default button as 2nd(256) or 3rd(512)
|
||||
SELECT CASE BoxType&
|
||||
CASE 2, 3, 6
|
||||
IF DBtn& = 2 THEN Icon& = Icon& + MB_DEFBUTTON3& ELSE Icon& = Icon& + MB_DEFBUTTON2& '3 button
|
||||
CASE ELSE: Icon& = Icon& + MB_DEFBUTTON2& '2nd button default
|
||||
END SELECT
|
||||
END IF
|
||||
Focus& = MB_SetFocus&
|
||||
MsgBox& = MessageBoxA&(_WINDOWHANDLE, Message$, Title$, BoxType& + Icon& + Mode& + Focus&) 'focus on button
|
||||
END FUNCTION
|
||||
|
||||
```
|
||||
|
||||
> *Explanation:* Notice how the call to the external dynamic library function MessageBoxA& passes _WINDOWHANDLE to the API and how the message box shown is created as a child of your program's window, not allowing the main window to be manipulated while the message box is open.
|
||||
|
||||
## See Also
|
||||
|
||||
* [_WINDOWHASFOCUS](_WINDOWHASFOCUS)
|
||||
* [Windows Libraries](Windows-Libraries)
|
|
@ -1,42 +0,0 @@
|
|||
The [_WINDOWHASFOCUS](_WINDOWHASFOCUS) function returns true (-1) if the current program's window has focus. Windows-only.
|
||||
|
||||
## Syntax
|
||||
|
||||
> hasFocus%% = [_WINDOWHASFOCUS](_WINDOWHASFOCUS)
|
||||
|
||||
## Description
|
||||
|
||||
* 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](Keywords-currently-not-supported-by-QB64).
|
||||
|
||||
## Availability
|
||||
|
||||
* Build 20170924/68 and up.
|
||||
|
||||
## Example(s)
|
||||
|
||||
Detecting if the current program has focus. Windows and Linux-only.
|
||||
|
||||
```vb
|
||||
|
||||
DO
|
||||
IF _WINDOWHASFOCUS THEN
|
||||
COLOR 15, 6
|
||||
CLS
|
||||
PRINT "*** Hi there! ***"
|
||||
ELSE
|
||||
COLOR 0, 7
|
||||
CLS
|
||||
PRINT "(ain't nobody looking...)"
|
||||
END IF
|
||||
_DISPLAY
|
||||
_LIMIT 30
|
||||
LOOP
|
||||
|
||||
```
|
||||
|
||||
> *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.
|
||||
|
||||
## See Also
|
||||
|
||||
* [_SCREENEXISTS](_SCREENEXISTS)
|
Loading…
Reference in a new issue