Kodi Documentation 18.0
Kodi is an open source media player and entertainment hub.
Callback functions from Kodi to add-on

GUI window callback functions. More...

Modules

 Action Id's
 Actions that we have defined.
 

Functions

 XBMCAddon::xbmcgui::Window::onAction (...)
 
void XBMCAddon::xbmcgui::Window::onControl (...)
 
 XBMCAddon::xbmcgui::Window::onClick (...)
 
 XBMCAddon::xbmcgui::Window::onDoubleClick (...)
 
 XBMCAddon::xbmcgui::Window::onFocus (...)
 
 XBMCAddon::xbmcgui::Window::onInit (...)
 

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

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> onAction(self, Action action) </big></font></span></code></h4> \endhtmlonly

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

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> onClick(self, int controlId) </big></font></span></code></h4> \endhtmlonly

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

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> onControl(self, Control) </big></font></span></code></h4> \endhtmlonly

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

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> onDoubleClick(self, int controlId) </big></font></span></code></h4> \endhtmlonly

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

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> onFocus(self, int controlId) </big></font></span></code></h4> \endhtmlonly

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

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> onInit(self) </big></font></span></code></h4> \endhtmlonly

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")
..