[Approved] String comparison logic for the visible property of skin elements (1 Viewer)

ZealotSix

Portal Pro
August 18, 2008
181
69
Home Country
United States of America United States of America
I would like to be able to use string comparison logic for the visible property of skin elements. For example, if a skin designer would like an element to be visible if a particular plugin's property (PropertyX) is a certain value ("foo") and PropertyY is a value "bar", he could use something like the following psudocode:
Code:
<visible>String.Equals(#MyPlugin.PropertyX,foo) + String.Equals(#MyPlugin.PropertyY,bar)</visible>

Is something like this currently possible with any of the existing values of the Visible property?

If not, I will be interested in writing a patch to add this functionality. I would like to hear suggestions from others on preferred syntax.

Thanks,
Travis
 

ZealotSix

Portal Pro
August 18, 2008
181
69
Home Country
United States of America United States of America
  • Thread starter
  • Moderator
  • #2
Please consider this patch for inclusion in MediaPortal 1.0.2. (or the next non-critical release of 1.x)

After researching the code for the above question, I found that there is a setting intended to accomplish this very goal called skin.string(val1,val2). Unfortunately however there were some bugs with this which caused it to never evaluate true because the first string would always resolve to "", no matter what the skin designer entered.

I have fixed the bug in the attached patch. It will now compare string1 to string2, and evaluate true if they match. It leverages GUIPropertyManager.Parse in order to resolve any properties that were set by skins.

Thanks!
Travis
 

Attachments

  • skin_string.patch
    30.6 KB

ltfearme

Community Plugin Dev
  • Premium Supporter
  • June 10, 2007
    6,755
    7,200
    Sydney
    Home Country
    Australia Australia
    Can someone move this to the patches thread so the DEVs have visibility.
     

    SilentException

    Retired Team Member
  • Premium Supporter
  • October 27, 2008
    2,617
    1,130
    Rijeka, Croatia
    Home Country
    Croatia Croatia
    anyone got this to work properly? i'm testing like this
    <define>#use_star_rating:yes</define>

    <control>
    <description>IMDB Rating</description>
    <type>fadelabel</type>
    <id>905</id>
    <posX>800</posX>
    <posY>360</posY>
    <width>180</width>
    <label>#use_star_rating</label>
    <font>font13</font>
    <visible>!String.Equals(#use_star_rating,yes)+Control.IsVisible(24)</visible>
    </control>

    any pointers?



    EDIT: d'oh, it cannot be used with <define> properties.. pitty
     

    Harley

    Retired Team Member
  • Premium Supporter
  • May 7, 2004
    2,053
    1,993
    Germany
    Home Country
    Germany Germany
    like it is in svn now, is there a description for using it in the Wiki ??

    Realy important , by all adding new stuff is to hold the wiki actuall !!

    Greetings Harley
     

    ltfearme

    Community Plugin Dev
  • Premium Supporter
  • June 10, 2007
    6,755
    7,200
    Sydney
    Home Country
    Australia Australia
    I think now that this functionality exists, plugin developers probably dont need to use dummy controls any more...we could just set a skin property and skinners can just use the string.equals function to evaluate conditions.
     

    Users who are viewing this thread

    Top Bottom