Kodi Documentation  20.0 Kodi is an open source media player and entertainment hub.
Subclass - ControlTextBox

Used to show a multi-page piece of text. More...

Collaboration diagram for Subclass - ControlTextBox:

## Functions

#### Function: setText(text)

Sets the text for this textbox. More...

#### Function: getText()

Returns the text value for this textbox. More...

#### Function: reset()

Clear's this textbox. More...

#### Function: scroll(id)

Scrolls to the given position. More...

#### Function: autoScroll(delay, time, repeat)

Set autoscrolling times. More...

## Detailed Description

Used to show a multi-page piece of text.

#### Class: ControlTextBox(x, y, width, height[, font, textColor])

The text box is used for showing a large multipage piece of text in Kodi. You can choose the position, size, and look of the text.

Note
This class include also all calls from Control
Parameters
 x integer - x coordinate of control. y integer - y coordinate of control. width integer - width of control. height integer - height of control. font [opt] string - font used for text. (e.g. 'font13') textColor [opt] hexstring - color of textbox's text. (e.g. '0xFFFFFFFF')
Note
You can use the above as keywords for arguments and skip certain optional arguments.
Once you use a keyword, all following arguments require the keyword.
After you create the control, you need to add it to the window with addControl().

Example:

...
# ControlTextBox(x, y, width, height[, font, textColor])
self.textbox = xbmcgui.ControlTextBox(100, 250, 300, 300, textColor='0xFFFFFFFF')
...

As stated above, the GUI control is only created once added to a window. The example below shows how a ControlTextBox can be created, added to the current window and have some of its properties changed.

Extended example:

...
textbox = xbmcgui.ControlTextBox(100, 250, 300, 300, textColor='0xFFFFFFFF')
window = xbmcgui.Window(xbmcgui.getCurrentWindowId())
textbox.setText("My Text Box")
textbox.scroll()
...

## ◆ autoScroll()

#### Function: autoScroll(delay, time, repeat)

Set autoscrolling times.

Parameters
 delay integer - Scroll delay (in ms) time integer - Scroll time (in ms) repeat integer - Repeat time
Note
autoScroll only works after you add the control to a window.
v15 Python API changes:

Example:

...
self.textbox.autoScroll(1, 2, 1)
...

## ◆ getText()

#### Function: getText()

Returns the text value for this textbox.

Returns
To get text from box
v19 Python API changes:
getText() can now be used before adding the control to the window

Example:

...
# getText()
text = self.text.getText()
...

## ◆ reset()

#### Function: reset()

Clear's this textbox.

v19 Python API changes:
reset() will reset any text defined for this control even before you add the control to the window

Example:

...
# reset()
self.textbox.reset()
...

## ◆ scroll()

#### Function: scroll(id)

Scrolls to the given position.

Parameters
 id integer - position to scroll to.
Note
scroll() only works after the control is added to a window.

Example:

...
# scroll(position)
self.textbox.scroll(10)
...

## ◆ setText()

#### Function: setText(text)

Sets the text for this textbox.

Parameters
 text string - text string.
v19 Python API changes:
setText can now be used before adding the control to the window (the defined value is taken into consideration when the control is created)

Example:

...
# setText(text)
self.textbox.setText('This is a line of text that can wrap.')
...