CONSOLE: Difference between revisions
Jump to navigation
Jump to search
Navigation:
Main Page with Articles and Tutorials
Keyword Reference - Alphabetical
Keyword Reference - By usage
Report a broken link
m (Protected "CONSOLE" ([Edit=Allow only autoconfirmed users] (indefinite) [Move=Allow only autoconfirmed users] (indefinite))) |
m (Add _ECHO to See Also) |
||
(6 intermediate revisions by one other user not shown) | |||
Line 14: | Line 14: | ||
* [[_SCREENHIDE]] or [[_SCREENSHOW]] can be used to hide or display the main program window. | * [[_SCREENHIDE]] or [[_SCREENSHOW]] can be used to hide or display the main program window. | ||
* The [[$SCREENHIDE]] [[Metacommand]] can hide the main program window throughout a program when only the console is used. | * The [[$SCREENHIDE]] [[Metacommand]] can hide the main program window throughout a program when only the console is used. | ||
* '''Note:''' Text can be copied partially or totally from console screens in Windows by highlighting and using the title bar menu. | * '''Note:''' Text can be copied partially or totally from console screens in Windows by highlighting and using the title bar menu. | ||
:: To copy console text output, right click the title bar and select ''Edit'' for ''Mark'' to highlight and repeat to ''Copy''. | :: To copy console text output, right click the title bar and select ''Edit'' for ''Mark'' to highlight and repeat to ''Copy''. | ||
{{PageExamples}} | {{PageExamples}} | ||
''Example 1:'' Hiding and displaying a console window. Use [[_DELAY]] to place console in front of main program window. | ''Example 1:'' Hiding and displaying a console window. Use [[_DELAY]] to place console in front of main program window. | ||
{{CodeStart}} | {{CodeStart}} | ||
{{ | {{Cm|$CONSOLE}} | ||
{{Cl|_CONSOLE}} OFF 'close original console | {{Cl|_CONSOLE}} {{Cl|OFF}} {{Text|<nowiki>'close original console</nowiki>|#919191}} | ||
{{Cl|_DELAY}} 2 | {{Cl|_DELAY}} {{Text|2|#F580B1}} | ||
{{Cl|_CONSOLE}} ON 'place console above program window | {{Cl|_CONSOLE}} {{Cl|ON}} {{Text|<nowiki>'place console above program window</nowiki>|#919191}} | ||
{{Cl|_DEST}} {{Cl|_CONSOLE}} | {{Cl|_DEST}} {{Cl|_CONSOLE}} | ||
{{Cl|INPUT}} "Enter your name: ", nme$ 'get program input | {{Cl|INPUT}} {{Text|<nowiki>"Enter your name: "</nowiki>|#FFB100}}, nme$ {{Text|<nowiki>'get program input</nowiki>|#919191}} | ||
{{Cl|_CONSOLE}} OFF 'close console | {{Cl|_CONSOLE}} {{Cl|OFF}} {{Text|<nowiki>'close console</nowiki>|#919191}} | ||
{{Cl|_DEST}} 0 'destination program window | {{Cl|_DEST}} {{Text|0|#F580B1}} {{Text|<nowiki>'destination program window</nowiki>|#919191}} | ||
{{Cl|PRINT}} nme$ | {{Cl|PRINT}} nme$ | ||
{{Cl|END}} | {{Cl|END}} | ||
{{CodeEnd}} | {{CodeEnd}} | ||
: ''Explanation:'' The [[_DEST|destination]] must be changed with [[_DEST]] [[_CONSOLE]] to get [[INPUT]] from the [[$CONSOLE]] screen. | : ''Explanation:'' The [[_DEST|destination]] must be changed with [[_DEST]] [[_CONSOLE]] to get [[INPUT]] from the [[$CONSOLE]] screen. | ||
---- | |||
''Example 2:'' [[_CONSOLETITLE]] can be used to create a console title, but it must be redone every time the console window is restored once turned off: | ''Example 2:'' [[_CONSOLETITLE]] can be used to create a console title, but it must be redone every time the console window is restored once turned off: | ||
{{CodeStart}} | {{CodeStart}} | ||
{{ | {{Cm|$CONSOLE}} | ||
{{Cl|_CONSOLETITLE}} "firstone" | {{Cl|_CONSOLETITLE}} {{Text|<nowiki>"firstone"</nowiki>|#FFB100}} | ||
{{Cl|_DELAY}} 10 | {{Cl|_DELAY}} {{Text|10|#F580B1}} | ||
{{Cl|_CONSOLE}} OFF | {{Cl|_CONSOLE}} {{Cl|OFF}} | ||
{{Cl|_DELAY}} 10 | {{Cl|_DELAY}} {{Text|10|#F580B1}} | ||
{{Cl|_CONSOLE}} ON | {{Cl|_CONSOLE}} {{Cl|ON}} | ||
{{Cl|_CONSOLETITLE}} "secondone" | {{Cl|_CONSOLETITLE}} {{Text|<nowiki>"secondone"</nowiki>|#FFB100}} | ||
{{CodeEnd}} | {{CodeEnd}} | ||
: ''Note:'' Some versions of Windows may display the program path or Administrator: prefix in console title bars. | : ''Note:'' Some versions of Windows may display the program path or Administrator: prefix in console title bars. | ||
Line 55: | Line 56: | ||
{{PageSeeAlso}} | {{PageSeeAlso}} | ||
* [[$CONSOLE]], [[_CONSOLETITLE]] | * [[$CONSOLE]], [[_CONSOLETITLE]] | ||
* [[$SCREENHIDE]], [[$SCREENSHOW]] {{ | * [[$SCREENHIDE]], [[$SCREENSHOW]] {{Text|(QB64 [[Metacommand]]s)}} | ||
* [[_SCREENHIDE]], [[_SCREENSHOW]] | * [[_SCREENHIDE]], [[_SCREENSHOW]] | ||
* [[_DEST]] | * [[_DEST]], [[_ECHO]] | ||
{{PageNavigation}} | {{PageNavigation}} |
Latest revision as of 22:14, 4 June 2023
The _CONSOLE statement can be used to turn a console window ON/OFF.
Syntax
- _CONSOLE OFF or ON must be used after the $CONSOLE Metacommand has established that a console window is desired.
- _CONSOLE OFF turns the console window off once a console has been established using $CONSOLE:ON or ONLY.
- _CONSOLE ON should only be used after the console window has been turned OFF previously.
- _DEST _CONSOLE can be used to send screen output to the console window using QB64 commands such as PRINT.
- _SCREENHIDE or _SCREENSHOW can be used to hide or display the main program window.
- The $SCREENHIDE Metacommand can hide the main program window throughout a program when only the console is used.
- Note: Text can be copied partially or totally from console screens in Windows by highlighting and using the title bar menu.
- To copy console text output, right click the title bar and select Edit for Mark to highlight and repeat to Copy.
Examples
Example 1: Hiding and displaying a console window. Use _DELAY to place console in front of main program window.
$CONSOLE _CONSOLE OFF 'close original console _DELAY 2 _CONSOLE ON 'place console above program window _DEST _CONSOLE INPUT "Enter your name: ", nme$ 'get program input _CONSOLE OFF 'close console _DEST 0 'destination program window PRINT nme$ END |
- Explanation: The destination must be changed with _DEST _CONSOLE to get INPUT from the $CONSOLE screen.
Example 2: _CONSOLETITLE can be used to create a console title, but it must be redone every time the console window is restored once turned off:
$CONSOLE _CONSOLETITLE "firstone" _DELAY 10 _CONSOLE OFF _DELAY 10 _CONSOLE ON _CONSOLETITLE "secondone" |
- Note: Some versions of Windows may display the program path or Administrator: prefix in console title bars.
See also
- $CONSOLE, _CONSOLETITLE
- $SCREENHIDE, $SCREENSHOW (QB64 Metacommands)
- _SCREENHIDE, _SCREENSHOW
- _DEST, _ECHO