Skin functions: What is available? (1 Viewer)

Rob Hexenmeister

MP Donator
  • Premium Supporter
  • May 12, 2011
    207
    49
    Slaithwaite
    Home Country
    United Kingdom United Kingdom
    The online documentation on skin functions that we can use in our skins is very thin to say the least (Skin-Functions)

    Can anyone point me to a full list of available skin functions please that I can use within <onclick> events?

    Only skin.setfocus and plugin.isenabled are listed in this documentation.

    Many thanks
    RH
     

    Rob Hexenmeister

    MP Donator
  • Premium Supporter
  • May 12, 2011
    207
    49
    Slaithwaite
    Home Country
    United Kingdom United Kingdom
    Any available skin expression ;)

    Thank you, but I am still finding the documentation very unclear. I have of course seen this many times:

    There is also this page:
    Which lists a few but is unhelpful in that it links back to itself

    skin.setfocus is the only function I have mastered. I was wondering, rather than expressions, what functions there are similar to skin.setfocus for purposes of navigation, or setting skin properties, or if there are any functions to alter a control's properties (for example change a setting in a control that is unfocused)

    Thank you
    RH
     

    CyberSimian

    Test Group
  • Team MediaPortal
  • June 10, 2013
    2,849
    1,771
    Southampton
    Home Country
    United Kingdom United Kingdom
    The online documentation on skin functions that we can use in our skins is very thin to say the least
    Yes, the Wiki is "variable in quality", with many omissions, and some errors. The way that skin authors become adept is via trial and error, using the Wiki as a source of hints as to what is supported and how it might work. To paraphrase Winston Churchill: it is an annoyance up with which we have to put. :mad:

    My custom is to scan the skin files for DWHD, Titan, Ares, and Amped, to see how they use a particular facility. I use Windows "findstr.exe" to perform this search. It may be possible to use Windows "Search" dialogue, but I cannot work out how to use it :(.

    what functions there are similar to skin.setfocus for purposes of navigation
    To navigate between panels you use the <hyperlink> tag. On the "Recorded TV" panel I added to the left side menu a button that allows me to goto the "Search TV Guide" panel:

    Code:
    <control>
      <description>"Search TV Guide" button</description>
      <type>button</type>
      <id>501</id>
      <label>Search TV Guide</label>
      <hyperlink>604</hyperlink>
      <onup>5</onup>
      <ondown>6</ondown>
      <onleft>50</onleft>
      <onright>50</onright>
    </control>


    This works for panels that don't require any parameters. So it works for "Recorded TV", "TV Guide", "Search TV Guide", "Videos", and so on, but it does not work for "Upcoming Episodes" and similar panels that require one or more parameters in order to work correctly (there is no way that the skin author can specify those parameters).

    As @catavolt said, with the <onclick> tag you can use any function that is valid in an expression, but the vast majority of uses of <onclick> set skin settings, that is, variables that are defined in the file "SkinSettings.xml". There are basically two types of setting: strings and booleans:

    Code:
    <onclick>#(skin.setstring('#skin.list.rows',#selectedlabel33))</onclick>
    
    <onclick>#(skin.togglesetting('#skin.schedule.show.series'))</onclick>


    Important: the name of the skin setting to be set must be enclosed in single quotes. If you omit the quotes, the skin engine will replace the skin variable by its current value, and then set a skin setting whose name is the current value. Example:

    Code:
    <onclick>#(skin.togglesetting(#skin.schedule.show.series))</onclick>


    When the skin engine executes this code, it replaces #skin.schedule.show.series by its current value True or False, and then toggles the value of a skin variable called True or False. (Yes, I got caught out several times by this error.)

    Note: it is valid to omit the quotes around the name of the skin variable, but this is an advanced coding technique for use in special circumstances which I won't describe here.

    if there are any functions to alter a control's properties (for example change a setting in a control that is unfocused)
    There are no functions that do this :cry:. A really useful enhancement would be a function that could access and set any settings in the file "MediaPortal.xml". This would allow the skin author to test MP settings (not the same as skin settings), and alter the values of MP settings. But this function does not exist. :(

    -- from CyberSimian in the UK
     

    Rob Hexenmeister

    MP Donator
  • Premium Supporter
  • May 12, 2011
    207
    49
    Slaithwaite
    Home Country
    United Kingdom United Kingdom
    I too examine the skin xmls for clues, and the skins I have made have all been adaptations of other people's work. The 'theme' innovation, when that came in, was very helpful indeed as it enabled major changes to be trialled without corrupting the original skin files.

    The bit I am struggling with is the skin functions. This section of your very comprehensive reply is very interesting:

    As @catavolt said, with the <onclick> tag you can use any function that is valid in an expression, but the vast majority of uses of <onclick> set skin settings, that is, variables that are defined in the file "SkinSettings.xml". There are basically two types of setting: strings and booleans:

    Code:
    <onclick>#(skin.setstring('#skin.list.rows',#selectedlabel33))</onclick>
    
    <onclick>#(skin.togglesetting('#skin.schedule.show.series'))</onclick>


    Important: the name of the skin setting to be set must be enclosed in single quotes. If you omit the quotes, the skin engine will replace the skin variable by its current value, and then set a skin setting whose name is the current value. Example:

    Code:
    <onclick>#(skin.togglesetting(#skin.schedule.show.series))</onclick>


    When the skin engine executes this code, it replaces #skin.schedule.show.series by its current value True or False, and then toggles the value of a skin variable called True or False. (Yes, I got caught out several times by this error.)


    You have used two functions here : skin.setstring and skin.togglesetting

    It is a complete list of these functions and how to use them that I cannot find anywhere.
    From your examples, I am guessing that the first one sets the global skin variable skin.list.rows to whatever label is current in control(33) [not 100% sure on this]
    And the second one toggles the global skin variable skin.schedule.show.series between true and false

    Great, thats very helpful, so is the explanation on syntax. (y)

    The problem I have is that I can't find a complete list of these functions :(

    Shame about not being able to set the values in an unrelated control's tags. That would be a handy innovation. Something along the lines of:

    <control>
    <id>0</id>
    <type>button</type>
    ...
    ...
    ...
    <onclick>#(GUI.setcontrol('#control(99).visible',FALSE)) :cautious:
    ...
    ...
    </control>



    Anyway. Food for thought. If anyone does have a complete list of functions (skin.setstring, skin.togglesetting and so forth) then I would be eternally grateful if you could point me at them :D

    RH
     

    CyberSimian

    Test Group
  • Team MediaPortal
  • June 10, 2013
    2,849
    1,771
    Southampton
    Home Country
    United Kingdom United Kingdom
    You have used two functions here : skin.setstring and skin.togglesetting
    It is a complete list of these functions and how to use them that I cannot find anywhere.
    The Wiki is not well organised in this area :(. There are two places that are relevant:


    The second page is the one that you quoted above, and is the only description of the functions that relate to skin settings. That looks to be a complete list. The only quirk that I notice is that the function names are shown in mixed case, which I think will not work in expressions. The function names should be entirely lower case. (I need to check that to see what works.)

    The first page is where the contents of the second page should be placed. I will update the page with that change. I suspect that most skin authors look at the main descriptive sections of "Skin Architecture", and not at the "List of Changes" (well, that is how I work :D).

    I am not aware of any functions for manipulating skin controls, although the Wiki sometimes does not reflect what has been implemented :(, in both directions:
    • Some capabilities are documented in the Wiki but not in fact implemented.
    • Some capabilities are implemented but not documented in the Wiki.
    -- from CyberSimian in the UK
     

    CyberSimian

    Test Group
  • Team MediaPortal
  • June 10, 2013
    2,849
    1,771
    Southampton
    Home Country
    United Kingdom United Kingdom
    The function names should be entirely lower case. (I need to check that to see what works.)
    I have just tried using a skin function with a mixed case name, but as expected it does not work. This is the resulting entry in the log file:

    Code:
    [ERROR] - Undefined function 'Skin.SetString' in expression '#(Skin.SetString('#skin.list.rows',#selectedlabel33))'


    -- from CyberSimian in the UK
     

    CyberSimian

    Test Group
  • Team MediaPortal
  • June 10, 2013
    2,849
    1,771
    Southampton
    Home Country
    United Kingdom United Kingdom
    The Wiki is not well organised in this area :(.
    I have just noticed that the following page describes the functions relating to skin settings:


    It provides more detail than the page in the "Changes" section linked earlier:


    Yes, the Wiki is not well organised in this area. :(

    -- from CyberSimian in the UK
     

    Users who are viewing this thread

    Top Bottom