updating oE get_screen_char

get_screen_char

include console.e 
namespace console 
public function get_screen_char(positive_atom line, positive_atom column, integer fgbg = 0) 

gets the value and attribute of the character at a given screen location.

Parameters:
  1. line : the 1-base line number of the location.
  2. column : the 1-base column number of the location.
  3. fgbg : an integer, if 0 (the default) you get an attribute_code returned otherwise you get a foreground and background color number returned.
Returns:
  • If fgbg is zero then a sequence of two elements, {character, attribute_code} for the specified location.
  • If fgbg is not zero then a sequence of three elements, {characterfg_color, bg_color}.
Comments:
  • This function inspects a single character on the active page.
  • The attribute_code is an atom that contains the foreground and background color of the character, and possibly other operating-system dependant information describing the appearance of the character on the screen.
  • With get_screen_char and put_screen_char you can save and restore a character on the screen along with its attribute_code.
  • The fg_color and bg_color are integers in the range 0 to 15 which correspond to the values in the table:

Color Table

color number name
0 black
1 dark blue
2 green
3 cyan
4 crimson
5 purple
6 brown
7 light gray
8 dark gray
9 blue
10 bright green
11 light blue
12 red
13 magenta
14 yellow
15 white
Example 1:
-- read character and attributes at top left corner 
s = get_screen_char(1,1) 
-- s could be {'A', 92} 
-- store character and attributes at line 25, column 10 
put_screen_char(25, 10, s) 
Example 2:
-- read character and colors at line 25, column 10. 
s = get_screen_char(25,10, 1) 
-- s could be {'A', 12, 5} 
See Also:

put_screen_char, save_text_image

Not Categorized, Please Help

Search



Quick Links

User menu

Not signed in.

Misc Menu