Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
Callback functions from Kodi to add-on

GUI window callback functions. More...

Topics

 Action Id's
 Actions that we have defined.
 

Functions

 XBMCAddon::xbmcgui::Window::onAction (...)
 

Function: onAction(self, Action action)


onAction method.
 
void XBMCAddon::xbmcgui::Window::onControl (...)
 

Function: onControl(self, Control)


onControl method.
 
 XBMCAddon::xbmcgui::Window::onClick (...)
 

Function: onClick(self, int controlId)


onClick method.
 
 XBMCAddon::xbmcgui::Window::onDoubleClick (...)
 

Function: onDoubleClick(self, int controlId)


onDoubleClick method.
 
 XBMCAddon::xbmcgui::Window::onFocus (...)
 

Function: onFocus(self, int controlId)


onFocus method.
 
 XBMCAddon::xbmcgui::Window::onInit (...)
 

Function: onInit(self)


onInit method.
 

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()

void XBMCAddon::xbmcgui::Window::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')
..

◆ onClick()

void XBMCAddon::xbmcgui::Window::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")
..

◆ onControl()

void XBMCAddon::xbmcgui::Window::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)
..

◆ onDoubleClick()

void XBMCAddon::xbmcgui::Window::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()

void XBMCAddon::xbmcgui::Window::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()

void XBMCAddon::xbmcgui::Window::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")
..