HOW-TO:Make a dialog popup automatically with another one via skinning

From Official Kodi Wiki
Jump to: navigation, search
Home icon grey.png   ▶ Dev ▶ Skinning ▶ Skinning Tutorials ▶ HOW-TO:Make a dialog popup automatically with another one via skinning

If you want to show two dialogs at the same time, or force one window to show when a user opens another one, you can do so by setting the <visible> tags in the window that you wish to have automatically popup.

For instance, if you want to make the volume controls popup as soon as the Player controls dialog (normally brought up by pressing 'm' or 'menu') is up, you would edit the Volume control xml file (DialogVolumeBar.xml) and add the <visible> tag as follows:

<window>
  <defaultcontrol>1</defaultcontrol>
  <coordinates>
    <system>1</system>
    <left>20</left>
    <top>536</top>
  </coordinates>
  <visible>Window.IsActive(PlayerControls)</visible>
  <controls>
    ...
  </controls>
</window>

This forces the volume control dialog to be displayed only when the player controls are on screen.

The disadvantage of this, ofcourse, is that the normal function of the volume control will no longer work – that is, the volume dialog will not popup when you press the volup key. In order to support both the popping up of the dialog when the Player Controls are up, and the normal operation of the volume control, we'd change it to this:

<window>
  <defaultcontrol>1</defaultcontrol>
  <coordinates>
    <system>1</system>
    <left>20</left>
    <top>536</top>
  </coordinates>
  <visible>Window.IsActive(VolumeBar) | Window.IsActive(PlayerControls)</visible>
  <controls>
    ...
  </controls>
</window>


The Window.IsActive(VolumeBar) condition will be true whenever XBMC asks the volume control to popup, or whenever it is already onscreen, so that takes care of the usual operation of the volume control. The first condition Window.IsActive(PlayerControls) is only true if the player controls are onscreen. The | indicates an OR operation. Thus, the <visible> tag translates to “Display the volume controls if XBMC asks us to, or if the player controls are on screen”.

More information on the <visible> tag can be found here

More information on the different skin files, window names, and id's can be found here

See also

Development:

Personal tools
Namespaces

Variants
Actions
Navigation
Wiki help
Toolbox