Player APIs (BrightScript & Ja...
...
Object Reference
Presentation and Widget Object...

roTextField

13min
a text field represents an area of the screen that can contain arbitrary text this feature is intended for presenting diagnostic and usage information use the rotextwidget object to generate text for user interfaces and signage object creation the object is created with several parameters createobject("rotextfield", xpos as integer, ypos as integer, width in chars as integer, height in chars as integer, metadata as object) xpos the horizontal coordinate for the top left of the text field ypos the vertical coordinate for the top left of the text field the top of the screen is equivalent to zero width in chars the width of the text field in character cells height in chars the height of the text field in character cells metadata an optional roassociativearray containing extra parameters for the text field you can pass zero if you do not require this the metadata associative array supports the following extra parameters "charwidth" the width of each character cell in pixels "charlength" the height of each character cell in pixels "backgroundcolor" the background color of the text field as an integer specifying eight bits (for each) for red, green and blue in the form \&hrrggbb "textcolor" the color of the text as an integer specifying eight bits (for each) for red, green and blue in the form \&hrrggbb "size" an alternative to "charwidth" and "charlength" for specifying either normal size text (0) or double sized text (1) in tv modes, a border around the screen may not be displayed due to overscanning you may want to use the rovideomode object functions getsafex() and getsafey() to ensure that the coordinates you use will be visible iftextfield cls() as void clears the text field getwidth() as integer returns the width of the text field getheight() as integer returns the height of the text field setcursorpos(x as integer, y as integer) as void moves the cursor to the specified position subsequent output will appear at this position getvalue() as integer returns the value of the character currently under the cursor raise() as void sends the widget to the top of the z order on the graphics plane (i e in front of all other surfaces that implement the ifwidget interface) by default, new widgets are placed at the top of the graphics z order some surfaces are always drawn at the top of the graphics z order, including the mouse cursor, closed captions, and rotextwidget docid\ gqenktmmfazejdlzhttiz you can use the pausegraphics() / resumegraphics() methods on the rovideomode docid\ qq734nqz0hcwni0unsdmp object to ensure multiple changes to the graphics z order occur simultaneously lower() as void sends the widget to the bottom of the z order on the graphics plane (i e behind all other surfaces that implement the ifwidget interface) by default, new widgets are placed at the top of the graphics z order ifstreamsend sendbyte(byte as integer) as void writes the character indicated by the specified number at the current cursor position within the text field it then advances the cursor sendline(string as string) as void writes the characters specified at the current cursor position followed by the end of line sequence sendblock(string as dynamic) as void writes the characters specified at the current cursor position and advances the cursor to one position beyond the last character this method can support either a string or an robytearray docid 9xvzitnmurdlaayfgiacu if the block is a string, any null bytes will terminate the block setsendeol(string as string) as void sets the sequence sent at the end of a sendline() value you should leave this at the default ascii value of 13 (carriage return) for normal use if you need to change this value to another non printing character, use the chr global functions docid\ nsjxffr7olfgdwgjfebme the ifstreamsend interface is also described in the section documenting the various file objects the interface is described again here in a manner more specific to the rotextfield object printing a text field as with any object that implements the ifstreamsend interface, a text field can be written to using the print #textfield syntax see the example below for more details it is also possible to write to a text field using the syntax print #textfield, @pos, where pos is the character position in the textfield for example, if your textfield object has 8 columns and 3 rows, writing to position 17 writes to row 3, column 2 (positions 0 7 are in row 1; positions 8 15 are in row 2; and positions 16 23 are in the last row) when output reaches the bottom of the text field, it will automatically scroll example meta = createobject("roassociativearray") meta addreplace("charwidth", 20) meta addreplace("charlength", 32) meta addreplace("backgroundcolor", \&h101010) ' dark grey meta addreplace("textcolor", \&hffff00) ' yellow vm = createobject("rovideomode") tf = createobject("rotextfield", vm getsafex(), vm getsafey(), 20, 20, meta) print #tf, "hello world" tf setcursorpos(4, 10) print #tf, "world hello"