Fork MediaPortal on GitHub
MediaPortal Windows Media Center
MediaPortal Wiki > MediaPortal 1 > Contribute > Skins > Skin Architecture > Skin Controls > Togglebutton

Togglebutton

Was this page helpful?
    deprecate.png

    On Tue, 30 Apr 2013, jameson_uk deprecated this page or content because it is no longer relevant, but has been retained for historical reference.

    Description

    The togglebutton control is obsolete - replaced by the new checkbutton control.  Plugins should update to the new control which supports new skin features.

    There are still instances in the MediaPortal core where a togglebutton control is used. 

    Note: The togglebutton control is scheduled to be completely removed from MediaPortal in 1.4.0.

    Changelog

    ChangeDateVersion
    Text scrolling on Checkbutton, Togglebutton2013/01/271.2.0 to 1.3.0
    Enhance textXOff in Buttons2011/12/171.2.0 to 1.3.0
    Togglebutton removed2012/11/131.3.0 to 1.4.0
    Text Padding2013/01/271.2.0 to 1.3.0
    Shadow text2010/10/101.0.1 to 1.1.0

    Tags

    Togglebutton

    Element Name

    Data Type

    Description

    textureFocus

    Integer

    The texture to display when the togglebutton is on and has focus

    textureNoFocus

    String

    The texture to display when the button is on and does not have focus

    AltTextureFocus

    String

    The texture to display when the togglebutton is off and has focus

    AltTextureNoFocus

    String

    The texture to display when the button is off and does not have focus

    font

    String

    The font to use to display the label

    label

    String

    The label text, property or a number that corresponds to an id in the strings.xml file

    textcolor

    Long

    The color of the text. Defaults to 0xFFFFFFFF

    textcolorNoFocus

    Long

    The color of the text when the togglebutton does not have the focus/not selected. Defaults to 0xFFFFFFFF

    disabledcolor

    Long

    The color of the text when the togglebutton is disabled. Defaults to 0xFF606060

    hyperlink

    Integer

    The id of the xml skin page that MP will load when the button is pushed

    textXOff [hasMargin]

    Integer

    The number of pixels the text label is offset from the left edge of the togglebutton image

          hasMargin

    Boolean

    [Since 1.3] If true, textXOff is used to provide horizontal space before and after the button label.

    textYOff

    Integer

    The number of pixels the text label is offset from the top edge of the togglebutton image

    textpadding

    Integer

    [Since 1.3]  provides "space" inside the label text to prevent overlap with graphics that follow on the right.

    textalign

    Alignment

    Align the text, possible values are: "left", "right" or "center". Default is "left"

    textvalign

    Alignment

    Vertical align of the text "top", "middle", "bottom"

    shadowAngle

    Integer

    Angle between text and the text shadow. Default is 0

    shadowDistance

    Integer

    Distance between the text and the shadow. Default is 0

    shadowColor

    Integer

    Color of the text shadow. Default is 0xFF000000 (black)

    scrollStartDelaySec

    Integer

    [Since 1.3] Sets the delay before scrolling starts, and enables scrolling of label text when it is too long for the texture

    scrollWrapString

    String

    [Since 1.3] Character to identify the end of the label text as it scrolls 

    onclick

    String

    [Since 1.3] Executes a MediaPortal skin function when the button is clicked.  See Skin Settings for more information.

     

    Inherited by Control

    See GUIControl for the full documentation of this control.

    Element Name Data Type Description
    id Integer The id of the control. The id will couple the skin file to the code, so if we later on want to check that a user pressed a button, the id will be required and must be unique. For controls that will never be referenced in the code it is safe to set it to "1"
    description String An optional description of the control for your reference
    type String The type of the control, for instance "button", "label", "textbox" and all other controls.
    posX Integer The X-position on the window for this control
    posY Integer The Y-position on the window for this control
    width Integer The width of this control
    height Integer The height of this control
    onleft Integer The control id to move the focus to when the user moves left. If not specified (or zero) MediaPortal will find the closest control in that direction to move to. As of v1.7.0 Skin Settings and Skin Expressions are also supported. 
    onright Integer The control id to move the focus to when the user moves right. If not specified (or zero) MediaPortal will find the closest control in that direction to move to. As of v1.7.0 Skin Settings and Skin Expressions are also supported. 
    onup Integer The control id to move the focus to when the user moves up. If not specified (or zero) MediaPortal will find the closest control in that direction to move to. As of v1.7.0 Skin Settings and Skin Expressions are also supported. 
    ondown Integer The control id to move the focus to when the user moves down. If not specified (or zero) MediaPortal will find the closest control in that direction to move to. As of v1.7.0 Skin Settings and Skin Expressions are also supported. 
    colordiffuse Long Allows you to mix a color & a graphics texture. E.g. If you have a graphics texture like a blue button you can mix it with a yellow color diffuse and the end result will be green. Defaults to 0xFFFFFFFF
    dimColor Integer Color for a control when it is not focussed. Defaults to half transparent (0x60ffffff)
    onfocus String [Since 1.3] Executes a MediaPortal skin function when the control gains focus.  See Skin Settings for more information.

    XML samples

    <control>
            <id>305</id>
            <description>GUIToggleButton (togglebutton)</description>
            <type>togglebutton</type>
            <onleft>500</onleft>
            <onright>306</onright>
            <onup>303</onup>
            <ondown>307</ondown>
            <colordiffuse>ffffffff</colordiffuse>
            <posX>40</posX>
            <posY>375</posY>
            <width>190</width>
            <height>32</height>
            <font>font13</font>
            <textureFocus>togglebutton-on-focus.png</textureFocus>
            <textcolor>ffffffff</textcolor>
            <disabledcolor>60ffffff</disabledcolor>
            <textureNoFocus>togglebutton-on-nofocus.png</textureNoFocus>
            <label>Toggle</label>
            <textXOff>10</textXOff>
            <textYOff>5</textYOff>
            <textalign>left</textalign> (added in 1.2.0 beta)
            <textvalign>middle</textvalign> (added in 1.2.0 beta)
            <animation effect="Zoom" end="105,105" start="100,100" time="100">Focus</animation>
            <animation effect="Zoom" end="100,100" start="105,105" time="300">UnFocus</animation>
            <AltTextureFocus>togglebutton-off-focus.png</AltTextureFocus>
            <AltTextureNoFocus>togglebutton-off-nofocus.png</AltTextureNoFocus>
          </control>

     

    Position text using textXOff while preserving the width of the label text by setting the textXOff property hasMargin to "no";

    <textXOff hasMargin="no">20</textXOff>



    Running the latest version?

    V1.8.0 - released July 2014
    Releasenews | Download
    Changelog
     | Requirements
    HTPC
    Team-MediaPortal
     
    About
    Contact |  Press
    Partners