mirror of
https://github.com/QB64Official/qb64.git
synced 2024-08-22 09:05:08 +00:00
49 lines
1.9 KiB
Text
49 lines
1.9 KiB
Text
{{DISPLAYTITLE:_CONTROLCHR}}
|
|
The [[_CONTROLCHR]] statement can be used to turn OFF control character attributes and allow them to be printed.
|
|
|
|
|
|
{{PageSyntax}}
|
|
: [[_CONTROLCHR]] {OFF|ON}
|
|
|
|
|
|
{{PageDescription}}
|
|
* The [[OFF]] clause allows control characters 0 to 31 to be printed and not format printing as normal text characters.
|
|
::For example: '''{{text|PRINT CHR$(13)|green}}''' 'will not move the cursor to the next line 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.
|
|
|
|
|
|
{{PageExamples}}
|
|
''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}}
|
|
|
|
|
|
{{PageSeeAlso}}
|
|
* [[_CONTROLCHR (function)]]
|
|
* [[CHR$]], [[ASC]]
|
|
* [[INKEY$]], [[_KEYHIT]]
|
|
* [[ASCII]] {{text|(codes)}}
|
|
* [[ASCII#Control_Characters|Control Characters]]
|
|
|
|
|
|
{{PageNavigation}}
|