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

From XBMC4Xbox
Jump to navigation Jump to search

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 Start) is up, you would edit the Volume control xml file (DialogVolumeBar.xml) and add the <visible> tag as follows:

<window>
  <id>104</id>
  <defaultcontrol>1</defaultcontrol>
  <coordinates>
    <system>1</system>
    <posX>20</posX>
     <posY>536</posY>
  </coordinates>
  <type>dialog</type>
  <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 on movement of the right thumbstick. 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>
  <id>104</id>
  <defaultcontrol>1</defaultcontrol>
  <coordinates>
    <system>1</system>
    <posX>20</posX>
     <posY>536</posY>
  </coordinates>
  <type>dialog</type>
  <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