1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-07-05 22:50:23 +00:00
QB64-PE/internal/help/_CONTROLCHR.txt
2016-03-18 08:36:04 -03:00

53 lines
2 KiB
Plaintext

{{DISPLAYTITLE:_CONTROLCHR}}
The '''_CONTROLCHR''' statement can be used to turn OFF control character attributes and allow them to be printed.
{{PageSyntax}}
::: '''_CONTROLCHR''' {'''OFF'''|ON}
{{Parameters}}
* Keyword must be used with '''OFF''' or '''ON'''(default) if previously turned OFF.
''Usage:''
* The [[OFF]] statement allows control characters 0 to 31 to be printed and not format printing as normal text characters.
::For example: '''{{text|PRINT CHR$(7)|green}}''' 'will not [[BEEP]] and '''{{text|PRINT CHR$(9)|green}}''' 'will not tab.
* The default [[ON]] statement allows [[ASCII#Control_Characters|Control Characters]] to be used as control commands where some will not print or will format prints.
* '''Note:''' File prints may be affected also when using Carriage Return or Line Feed/Form Feed formatting!
* The QB64 [[IDE]] may allow Alt + number pad character entries, but they must be inside of [[STRING]] values. Otherwise the [[IDE]] may not recognize them.
''Example:'' Printing the 255 [[ASCII]] characters in [[SCREEN]] 0 with 32 colors.
{{CodeStart}} '' ''
{{Cl|DIM}} i {{Cl|AS}} {{Cl|_UNSIGNED}} {{Cl|_BYTE}}
{{Cl|WIDTH}} 40, 25
{{Cl|CLS}}
{{Cl|_CONTROLCHR}} OFF
i = 0
DO
{{Cl|PRINT}} {{Cl|CHR$}}(i);
i = i + 1
{{Cl|IF...THEN|IF}} (i {{Cl|AND (boolean)|AND}} {{Cl|&H}}F) = 0 {{Cl|THEN}} {{Cl|PRINT}}
{{Cl|LOOP}} {{Cl|WHILE}} i
{{Cl|LOCATE}} 1, 20
DO
{{Cl|COLOR}} i {{Cl|AND (boolean)|AND}} {{Cl|&H}}F {{Cl|OR (boolean)|OR}} (i {{Cl|AND (boolean)|AND}} {{Cl|&H}}80) \ {{Cl|&H}}8, (i {{Cl|AND (boolean)|AND}} {{Cl|&H}}70) \ {{Cl|&H}}10
{{Cl|PRINT}} {{Cl|CHR$}}(i);
i = i + 1
{{Cl|IF...THEN|IF}} (i {{Cl|AND (boolean)|AND}} {{Cl|&H}}F) = 0 {{Cl|THEN}} {{Cl|LOCATE}} 1 + i \ {{Cl|&H}}10, 20
{{Cl|LOOP}} {{Cl|WHILE}} i
{{Cl|END}} '' ''
{{CodeEnd}}
''See also:''
* [[_CONTROLCHR (function)]]
* [[CHR$]], [[ASC]]
* [[INKEY$]], [[_KEYHIT]]
* [[ASCII]] {{text|(codes)}}
* [[ASCII#Control_Characters|Control Characters]]
{{PageNavigation}}