4988: Conditional navigation (1 Viewer)

Rob Hexenmeister

MP Donator
  • Premium Supporter
  • May 12, 2011
    151
    34
    Slaithwaite
    United Kingdom United Kingdom
    Country flag
    Good evening everyone,

    Could someone correct my homework please, I can't work out what I am doing wrong in the following expression:

    <ondown>#(iif(control.isvisible(50),50,6))</ondown>

    I've spent ages on it and I am not moving anywhere fast, figuratively and literally.

    Many thanks
    RH
     

    CyberSimian

    Test Group
  • Team MediaPortal
  • June 10, 2013
    1,994
    1,234
    Southampton
    United Kingdom United Kingdom
    Country flag
    I can't work out what I am doing wrong in the following expression:
    <ondown>#(iif(control.isvisible(50),50,6))</ondown>
    I think that the answer is that control.isvisible() is not valid in an expression. :(

    I have just looked at the source for my "ClassicWide" skin, and I do not find a single occurrence where control.isvisible() is used in an expression. Instead I find code like this:

    Code:
    <onup>#(switch(
            eq(#currentmoduleid,'6'   ),'50',
            eq(#currentmoduleid,'601' ),'10',
            eq(#currentmoduleid,'603' ),'50',
            eq(#currentmoduleid,'604' ),'11',
            eq(#currentmoduleid,'763' ),'50',
            eq(#currentmoduleid,'8900'),'11',
            eq(1,1),'99'))</onup>

    Some "functions" are valid in expressions and in the "visible" tag; the various "String" functions are like this. But other "functions" are valid only in one place (expressions or the "visible" tag, but not both); the "Control" functions are like this.

    We both await the final verdict from the Guru... @catavolt? :D

    -- from CyberSimian in the UK
     

    ajs

    Development Group
  • Team MediaPortal
  • February 29, 2008
    11,828
    6,680
    Kyiv
    Ukraine Ukraine
    Country flag
    Try
    Code:
    <ondown>#(switch(
            eq(true,control.isvisible(50)),'50',
            eq(1,1),'6'))</ondown>
    But if you have Buttons with id:
    • 10
    • 50
    • 6
    And in button 10 ondown events - 50, when user press down, and button 50 not visible, skin engine move cursor to button 6 ...
     

    ajs

    Development Group
  • Team MediaPortal
  • February 29, 2008
    11,828
    6,680
    Kyiv
    Ukraine Ukraine
    Country flag
    IMHO need add this function to: MediaPortal/MediaPortal-1
    Like:
    C#:
    [XMLSkinFunction("control.isvisible")]
    public static bool ControlIsVisible(string id)
    {
      int condition = GUIInfoManager.TranslateString("control.isvisible(" + id+ ")");
      return GUIInfoManager.GetBool(condition, 0);
    }
    And after that should work :)
     

    Rob Hexenmeister

    MP Donator
  • Premium Supporter
  • May 12, 2011
    151
    34
    Slaithwaite
    United Kingdom United Kingdom
    Country flag
    Try
    Code:
    <ondown>#(switch(
            eq(true,control.isvisible(50)),'50',
            eq(1,1),'6'))</ondown>
    Sadly didn't work for me.

    Thinking I was clever, I also tried <ondown>#add(#mul(!control.isvisible(50),6),#mul(!control.isvisible(6),50))</ondown>

    I am clearly not clever.

    I see no option but to duplicate all of the buttons amending <ondown> to 50 or 6 and with conditional visibility based on those two controls.

    Thank you for your help as ever
    RH
     

    ajs

    Development Group
  • Team MediaPortal
  • February 29, 2008
    11,828
    6,680
    Kyiv
    Ukraine Ukraine
    Country flag
    <ondown>#add(#mul(!control.isvisible(50),6),#mul(!control.isvisible(6),50))</ondown>
    It seems to me more correct:
    Code:
    <ondown>#(add(mul(!control.isvisible(50),6),mul(!control.isvisible(6),50)))</ondown>
    Sadly didn't work for me.
     

    Rob Hexenmeister

    MP Donator
  • Premium Supporter
  • May 12, 2011
    151
    34
    Slaithwaite
    United Kingdom United Kingdom
    Country flag
    <ondown>#(add(mul(!control.isvisible(50),6),mul(!control.isvisible(6),50)))</ondown>
    Yes I think you're right, but it still won't work and I am getting my logic in a tangle. I think the easiest way is just to duplicate the buttons.

    Thank you for your help :)
     

    ajs

    Development Group
  • Team MediaPortal
  • February 29, 2008
    11,828
    6,680
    Kyiv
    Ukraine Ukraine
    Country flag
    Need add this function as i say above. Without it not work i think ...

    --
    WBR, ajs :):whistle::coffee:
     

    Users Who Are Viewing This Thread (Users: 0, Guests: 1)

    Top Bottom