Kodi Development  20.0
for Binary and Script based Add-Ons
Callback functions from Kodi to add-on

Detailed Description

GUI window callback functions.

Functions to handle control callbacks from Kodi.

Likewise, all functions from here as well in the all window classes (Window, WindowDialog, WindowXML and WindowXMLDialog) with inserted and available.


Go back to normal functions from window

Function Documentation

◆ onAction()

onAction (   ...)

Function: onAction(self, Action action)


onAction method.

This method will receive all actions that the main program will send to this window.

Parameters
selfOwn base class pointer
actionThe action id to perform, see Action to get use of them
Note
  • By default, only the PREVIOUS_MENU and NAV_BACK actions are handled.
  • Overwrite this method to let your script handle all actions.
  • Don't forget to capture ACTION_PREVIOUS_MENU or ACTION_NAV_BACK, else the user can't close this window.

Example:

..
# Define own function where becomes called from Kodi
def onAction(self, action):
if action.getId() == ACTION_PREVIOUS_MENU:
print('action received: previous')
self.close()
if action.getId() == ACTION_SHOW_INFO:
print('action received: show info')
if action.getId() == ACTION_STOP:
print('action received: stop')
if action.getId() == ACTION_PAUSE:
print('action received: pause')
..

◆ onControl()

void onControl (   ...)

Function: onControl(self, Control)


onControl method.

This method will receive all click events on owned and selected controls when the control itself doesn't handle the message.

Parameters
selfOwn base class pointer
controlThe Control class

Example:

..
# Define own function where becomes called from Kodi
def onControl(self, control):
print("Window.onControl(control=[%s])"%control)
..

◆ onClick()

onClick (   ...)

Function: onClick(self, int controlId)


onClick method.

This method will receive all click events that the main program will send to this window.

Parameters
selfOwn base class pointer
controlIdThe one time clicked GUI control identifier

Example:

..
# Define own function where becomes called from Kodi
def onClick(self,controlId):
if controlId == 10:
print("The control with Id 10 is clicked")
..

◆ onDoubleClick()

onDoubleClick (   ...)

Function: onDoubleClick(self, int controlId)


onDoubleClick method.

This method will receive all double click events that the main program will send to this window.

Parameters
selfOwn base class pointer
controlIdThe double clicked GUI control identifier

Example:

..
# Define own function where becomes called from Kodi
def onDoubleClick(self,controlId):
if controlId == 10:
print("The control with Id 10 is double clicked")
..

◆ onFocus()

onFocus (   ...)

Function: onFocus(self, int controlId)


onFocus method.

This method will receive all focus events that the main program will send to this window.

Parameters
selfOwn base class pointer
controlIdThe focused GUI control identifier

Example:

..
# Define own function where becomes called from Kodi
def onDoubleClick(self,controlId):
if controlId == 10:
print("The control with Id 10 is focused")
..

◆ onInit()

onInit (   ...)

Function: onInit(self)


onInit method.

This method will be called to initialize the window

Parameters
selfOwn base class pointer

Example:

..
# Define own function where becomes called from Kodi
def onInit(self):
print("Window.onInit method called from Kodi")
..