Difference between revisions of "SCREEN"

From QB64 Wiki
Jump to navigation Jump to search
imported>Clippy
m
imported>Clippy
m (added code temp)
Line 15: Line 15:


{{CodeStart}}
{{CodeStart}}
:SCREEN 0
  SCREEN 0
:row = 10: column = 10
  row = 10: column = 10
:COLOR 9: LOCATE row, column: PRINT "Hello"
  COLOR 9: LOCATE row, column: PRINT "Hello"
:code% = SCREEN(row, column, 0) ' character code return
  code% = SCREEN(row, column, 0) ' character code return
:attrib% = SCREEN(row, column, 1) ' character color return
  attrib% = SCREEN(row, column, 1) ' character color return
:COLOR 14: LOCATE 20, 10: PRINT "ASCII:"; code%, "COLOR:"; attrib%
  COLOR 14: LOCATE 20, 10: PRINT "ASCII:"; code%, "COLOR:"; attrib%
{{CodeEnd}}
{{CodeEnd}}



Revision as of 21:22, 11 January 2010

The SCREEN function returns the ASCII code of a text character or the color attribute at a set text location on the screen.


Syntax: code% = SCREEN (row, column [, {0|1}])


  • Row and column are the text coordinates of the SCREEN mode used.
  • Colorflag omitted or with a value of 0 returns the ASCII code of a character at the position designated.
  • When Colorflag is greater than 0, the function returns the color attribute used.
  • Color values returned may not be correct in screen modes other than SCREEN 0.


Example: Reading the ASCII code of a character, then the color used.

SCREEN 0 row = 10: column = 10 COLOR 9: LOCATE row, column: PRINT "Hello" code% = SCREEN(row, column, 0) ' character code return attrib% = SCREEN(row, column, 1) ' character color return COLOR 14: LOCATE 20, 10: PRINT "ASCII:"; code%, "COLOR:"; attrib%

Screen results:

Hello ASCII: 76 COLOR: 9



See also: PRINT, SCREEN (statement), COLOR, CHR$, POINT, CSRLIN, POS


Navigation:

Go to Keyword Reference - Alphabetical

Go to Keyword Reference - By usage