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
-
x | integer - x coordinate of control. |
y | integer - y coordinate of control. |
width | integer - width of control. |
height | integer - height of control. |
label | string 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:
Defination 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 |
|
focusTexture | [opt] string - filename for focus texture. |
noFocusTexture | [opt] string - filename for no focus texture. |
isPassword | [opt] bool - True=mask text value with **** (deprecated, use setType()). |
- 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
Example:
...
self.edit = xbmcgui.ControlEdit(100, 250, 125, 75, 'Status')
...
◆ getLabel()
String XBMCAddon::xbmcgui::ControlEdit::getLabel |
( |
| ) |
|
@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> getLabel() </big></font></span></code></h4> \endhtmlonly
Returns the text heading for this edit control.
- Returns
- Heading text
Example:
...
label = self.edit.getLabel()
...
◆ getText()
String XBMCAddon::xbmcgui::ControlEdit::getText |
( |
| ) |
|
@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> getText() </big></font></span></code></h4> \endhtmlonly
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()
...
◆ setLabel()
void XBMCAddon::xbmcgui::ControlEdit::setLabel |
( |
|
... | ) |
|
@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> setLabel(label[, font, textColor, disabledColor, shadowColor, focusedColor, label2]) </big></font></span></code></h4> \endhtmlonly
Set's text heading for this edit control.
- Parameters
-
label | string 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')
...
◆ setText()
void XBMCAddon::xbmcgui::ControlEdit::setText |
( |
|
... | ) |
|
@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> setText(value) </big></font></span></code></h4> \endhtmlonly
Set's text value for this edit control.
- Parameters
-
value | string or unicode - text string. |
Example:
...
self.edit.setText('online')
...
◆ setType()
void XBMCAddon::xbmcgui::ControlEdit::setType |
( |
|
... | ) |
|
@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> setType(type, heading) </big></font></span></code></h4> \endhtmlonly
Sets the type of this edit control.
- Parameters
-
type | integer - 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) |
|
heading | string 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.
Example:
...
self.edit.setType(xbmcgui.INPUT_TYPE_TIME, 'Please enter the time')
...