Kodi Development 22.0
for Binary and Script based Add-Ons
 
Loading...
Searching...
No Matches
Subclass - ControlEdit

Detailed Description

Used as an input control for the osd keyboard and other input fields.

Class: ControlEdit(x, y, width, height, label[, font, textColor, /// disabledColor, alignment, focusTexture, noFocusTexture])

The edit control allows a user to input text in Kodi. You can choose the font, size, colour, location and header of the text to be displayed.

Note
This class include also all calls from Control
Parameters
xinteger - x coordinate of control.
yinteger - y coordinate of control.
widthinteger - width of control.
heightinteger - height of control.
labelstring or unicode - text string.
font[opt] string - font used for label text. (e.g. 'font13')
textColor[opt] hexstring - color of enabled label's label. (e.g. '0xFFFFFFFF')
disabledColor[opt] hexstring - color of disabled label's label. (e.g. '0xFFFF3300')
alignment[opt] integer - alignment of label
  • Flags for alignment used as bits to have several together:
    Definition name Bitflag Description
    XBFONT_LEFT 0x00000000 Align X left
    XBFONT_RIGHT 0x00000001 Align X right
    XBFONT_CENTER_X 0x00000002 Align X center
    XBFONT_CENTER_Y 0x00000004 Align Y center
    XBFONT_TRUNCATED 0x00000008 Truncated text
    XBFONT_JUSTIFIED 0x00000010 Justify text
    XBFONT_TRUNCATED_LEFT 0x00000020 Truncated text from left
focusTexture[opt] string - filename for focus texture.
noFocusTexture[opt] string - filename for no focus texture.
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().

v18 Python API changes
Deprecated isPassword
v19 Python API changes
Removed isPassword

Example:

...
self.edit = xbmcgui.ControlEdit(100, 250, 125, 75, 'Status')
...

Function Documentation

◆ setLabel()

setLabel ( ...)

Function: setLabel(label[, font, textColor, disabledColor, shadowColor, focusedColor, label2])


Sets text heading for this edit control.

Parameters
labelstring or unicode - text string.
font[opt] string - font used for label text. (e.g. 'font13')
textColor[opt] hexstring - color of enabled label's label. (e.g. '0xFFFFFFFF')
disabledColor[opt] hexstring - color of disabled label's label. (e.g. '0xFFFF3300')
shadowColor[opt] hexstring - color of button's label's shadow. (e.g. '0xFF000000')
focusedColor[opt] hexstring - color of focused button's label. (e.g. '0xFF00FFFF')
label2[opt] string or unicode - text string.

Example:

...
self.edit.setLabel('Status')
...

◆ getLabel()

getLabel ( )

Function: getLabel()


Returns the text heading for this edit control.

Returns
Heading text

Example:

...
label = self.edit.getLabel()
...

◆ setText()

setText ( ...)

Function: setText(value)


Sets text value for this edit control.

Parameters
valuestring or unicode - text string.

Example:

...
self.edit.setText('online')
...

◆ getText()

getText ( )

Function: getText()


Returns the text value for this edit control.

Returns
Text value of control

v14 Python API changes
New function added.

Example:

...
value = self.edit.getText()
...

◆ setType()

setType ( ...)

Function: setType(type, heading)


Sets the type of this edit control.

Parameters
typeinteger - type of the edit control.
Param Definition
xbmcgui.INPUT_TYPE_TEXT (standard keyboard)
xbmcgui.INPUT_TYPE_NUMBER (format: #)
xbmcgui.INPUT_TYPE_DATE (format: DD/MM/YYYY)
xbmcgui.INPUT_TYPE_TIME (format: HH:MM)
xbmcgui.INPUT_TYPE_IPADDRESS (format: #.#.#.#)
xbmcgui.INPUT_TYPE_PASSWORD (input is masked)
xbmcgui.INPUT_TYPE_PASSWORD_MD5 (input is masked, return md5 hash of input)
xbmcgui.INPUT_TYPE_SECONDS (format: SS or MM:SS or HH:MM:SS or MM min)
xbmcgui.INPUT_TYPE_PASSWORD_NUMBER_VERIFY_NEW (numeric input is masked)
headingstring or unicode - heading that will be used for to numeric or keyboard dialog when the edit control is clicked.

v18 Python API changes
New function added.
v19 Python API changes
New option added to mask numeric input.

Example:

...
self.edit.setType(xbmcgui.INPUT_TYPE_TIME, 'Please enter the time')
...