Skin functions: What is available? (1 Viewer)

Rob Hexenmeister

MP Donator
  • Premium Supporter
  • May 12, 2011
    164
    38
    Slaithwaite
    United Kingdom United Kingdom
    Country flag
    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
    164
    38
    Slaithwaite
    United Kingdom United Kingdom
    Country flag
    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,136
    1,323
    Southampton
    United Kingdom United Kingdom
    Country flag
    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
    164
    38
    Slaithwaite
    United Kingdom United Kingdom
    Country flag
    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,136
    1,323
    Southampton
    United Kingdom United Kingdom
    Country flag
    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,136
    1,323
    Southampton
    United Kingdom United Kingdom
    Country flag
    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,136
    1,323
    Southampton
    United Kingdom United Kingdom
    Country flag
    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

    Similar threads
    OP Title Forum Replies Date
    ajs [solved] 4935: Add string.replace function to Skin engine MediaPortal 1 10
    M MP2 - V2.3 The skin resource for screen 'RecordingsShowItems' seems to be broken General 4
    Mainhattan Olli MP2 - V2.3 WMC Skin nach update auf MP2.3 Allgemeines Support- und Diskussionsforum 3
    S Stiefmütterliche Unterstützung für Maussteuerung in MP (Titan Skin) Allgemeines Supportforum 14
    Rob Hexenmeister Skinning Online Videos question OnlineVideos 2
    Rob Hexenmeister Quick question - skinning MyPics General Support 7
    ajs [Info] 0.7 Beta - MPExtended, WebMP, Bootstrap skin by ajs - Hard way MPExtended 616
    S Touchscreen skin? MediaPortal 1 Talk 6
    azzuro [fixed] 5011: Version label in Splash screen - pos, size from skin MediaPortal 1 61
    catavolt [WiP] When changing theme in my skins, I always get this error message in logs MediaPortal 1 9
    joecrow MultiShortcut Plugin (Uavailable) in DWHD skin General Support 58
    V Skin With Menu Editor MediaPortal 1 Skins 13
    wizard123 New Skin Template ? MediaPortal 2 8
    Rob Hexenmeister [solved] Latest Media Handler - skinning buttons Fanart Handler 19
    CyberSimian [solved] MP1-4976 Built-in skin variables for current date MediaPortal 1 8
    Mr6686 [solved] Titan skin broken since update to 1.23 Installation, configuration support 6
    doskabouter Skin question Skins and Plugins Installer (MPEI) 1
    Y Titan Skin unter 1.23 nicht mehr so schön Allgemeines Supportforum 1
    framug 1.22.0 BasicHome Editor settings for DefaultWide HD skin not kept when update 1.22 3
    catavolt [solved] FanartHandler - Skin - Holiday and Spotlight support Fanart Handler 51
    ajs [fixed] 4936 - Strange behavior of the font in the skin MediaPortal 1 35
    ajs [solved] Latest Media Handler - Skin settings - Custom latests items number Fanart Handler 27
    Rob Hexenmeister [solved] Latests Media Handler - Skinning an updating window or control Fanart Handler 26
    T Skin Wechsel Installationsprobleme? 1
    JJDoherty Designing & implementing a new skin... Skins and Design 8

    Similar threads

    Top Bottom