Conditional syntax (1 Viewer)

Rob Hexenmeister

MP Donator
  • Premium Supporter
  • May 12, 2011
    207
    49
    Slaithwaite
    Home Country
    United Kingdom United Kingdom
    Stuck again... sorry,

    Can anyone tell me what is wrong with the following or give me a better way....

    <onleft>#(iif(eq(Player.HasVideo,true),99,100))</onleft>

    I have also tried:
    <onleft>#(iif(eq(#Player.HasVideo,'true'),99,100))</onleft>
    <onleft>#(iif(eq(#Player.HasVideo,true),99,100))</onleft>
    <onleft>#(iif(eq(Player.HasVideo,'true'),99,100))</onleft>

    Thanks as ever
    RH
     

    CyberSimian

    Test Group
  • Team MediaPortal
  • June 10, 2013
    2,873
    1,801
    Southampton
    Home Country
    United Kingdom United Kingdom
    <onleft>#(iif(eq(Player.HasVideo,true),99,100))</onleft>
    Player.HasVideo is a "function" that is valid only in the <visible> tag, like so:

    <visible>Player.HasVideo</visible>

    Some "functions" are valid only in expressions (see this page).
    Some "functions" are valid only in the <visible> tag (see this page).
    Some functions are valid in both places (those functions that are listed on both of the Wiki pages linked above).

    Also note that function names in expressions are case sensitive, whereas function names in the <visible> tag are not. So String.Equals(...) is valid for the <visible> tag, but this must be coded as string.equals(...) in an expression.

    Also, string constants in expressions must be quoted, so to compare a skin variable to the value true, the value must be enclosed in single quotes:

    #(iif(eq(#HasSubtitles,'true'), ... , ... ) )

    -- from CyberSimian in the UK
     

    Rob Hexenmeister

    MP Donator
  • Premium Supporter
  • May 12, 2011
    207
    49
    Slaithwaite
    Home Country
    United Kingdom United Kingdom
    Some "functions" are valid only in expressions (see this page).
    Some "functions" are valid only in the <visible> tag (see this page).
    Some functions are valid in both places (those functions that are listed on both of the Wiki pages linked above).

    Thank you. Very informative.


    Very disappointing though. The problem I was trying to get around with conditional navigation is that I have a video preview pane with buttons either side of it.

    The video panel seems to be gaining focus even when it is not visible - i.e. when video is not playing.

    This means that I cannot cleanly navigate between buttons when the video panel is not visible - the focus "seems" to disappear but in reality it has gone to the invisible video panel.

    What I was trying to do was bypass this issue with conditional navigation -

    Eg: From left button:

    Left button has focus
    On right: if video panel is visible focus move to video panel, else focus move to right hand button

    Anyone got any ideas about how to prevent the video panel getting focus when hidden - or a way of doing the conditional navigation?

    Thanks
    RH
     

    CyberSimian

    Test Group
  • Team MediaPortal
  • June 10, 2013
    2,873
    1,801
    Southampton
    Home Country
    United Kingdom United Kingdom
    The video panel seems to be gaining focus even when it is not visible - i.e. when video is not playing.
    I have just made a quick modification to DWHD's "TV Home" panel (which has the layout that you describe), and can confirm that the focus does seem to go to the video control even when it is not visible :(. I had not noticed this before, as it is not a panel layout that I use.

    This means that I cannot cleanly navigate between buttons when the video panel is not visible - the focus "seems" to disappear but in reality it has gone to the invisible video panel.
    @catavolt has the same problem in DWHD. But he uses the artifice of displaying a fixed image in the position of the video window, and so the focus appears to move to the fixed image when there is no video playing. You need two button presses to get to the buttons on the right, but at least the focus does not appear to vanish.

    Given the limitations of the current skin engine, I cannot think of any way of being able to move the focus from the left to the right using only one button press :(.

    -- from CyberSimian in the UK
     

    Rob Hexenmeister

    MP Donator
  • Premium Supporter
  • May 12, 2011
    207
    49
    Slaithwaite
    Home Country
    United Kingdom United Kingdom
    Given the limitations of the current skin engine, I cannot think of any way of being able to move the focus from the left to the right using only one button press

    Yes, well I certainly haven't found anything.

    I don't think animations work with the video window do they, so I can't 'slide' it out of the way when it loses visibility.

    I was also wondering about using dummy buttons that become visible when the video window becomes invisible, and with a bit of strategic placement might do the jump to the required control.

    That would require something along these lines to work:

    <id>2</id>
    <type>button</type>
    <onfocus>#skin.setfocus(0,4)</onfocus>
    <visible>!control.isvisible(99)</visible>

    and

    <id>3</id>
    <type>button</type>
    <onfocus>#skin.setfocus(0,1)</onfocus>
    <visible>!control.isvisible(99)</visible>

    Layout

    Button1 Button2 VideoWindow Button3 Button 4

    Any comments? Ideas?

    Many thanks
    RH
     

    CyberSimian

    Test Group
  • Team MediaPortal
  • June 10, 2013
    2,873
    1,801
    Southampton
    Home Country
    United Kingdom United Kingdom
    <onfocus>#skin.setfocus(0,4)</onfocus>
    That might work, but I find that the skin engine is so inconsistent and incomplete that it is difficult to predict whether any particular set of tags will work as expected :(. So you will need to try it to find out. :unsure:

    A couple of points:

    (1) "skin.setfocus()" is a function that must be coded in an expression, so the line above should be:

    <onfocus>#(skin.setfocus(0,4))</onfocus>

    (2) I just scanned the source files for "DefaultWideHD" and I notice that @catavolt uses this variation:

    <onfocus>#(skin.setfocus(cint(#currentmoduleid),4))</onfocus>

    So that form would be a good starting point for the test. (y)

    -- from CyberSimian in the UK
     

    Rob Hexenmeister

    MP Donator
  • Premium Supporter
  • May 12, 2011
    207
    49
    Slaithwaite
    Home Country
    United Kingdom United Kingdom
    So that form would be a good starting point for the test. (y)

    Thank you for that. I shall give that a try at the weekend.

    I've also had a bit of success using Group and StackLayout/GridLayout. If the videowindow is simply used as a preview panel and not a control (i.e. no other controls navigate to it), I can do something like this:

    Layout :
    Button1 Button2 Button3

    Video window is placed directly behind Button2

    Button 2 is not visible unless video is playing, and has no textures. It has action 18 (Video full screen)

    Then there is an image control overlaid the Video window which is visible when Button2 has focus for the video focused frame highlight

    Oh and animations do sort-of work with the video window it seems. The live TV is always rendered at the starting coordinates of the control but the black box can be shifted when the video is not playing. I've done something like this:

    <animation effect="slide" end="0,-1000" time="1000">Hidden</animation>
    <visible>Player.HasVideo</visible>

    I will post the full code once I have had time to finish it.
    RH
     

    Rob Hexenmeister

    MP Donator
  • Premium Supporter
  • May 12, 2011
    207
    49
    Slaithwaite
    Home Country
    United Kingdom United Kingdom
    Given the limitations of the current skin engine, I cannot think of any way of being able to move the focus from the left to the right using only one button press :(.


    Grouping the controls certainly seems to be the way to go. I successfully got the jump from left to right working, with a button in the middle to do action 18 which is only visible when video is playing. Use the videowindow as a preview only, slide it out of the way when not playing as per the above, and put the group of three buttons over the top of it, remembering NOT to collapse the middle button when not visible.

    I've taken it a step further in the attached file with a grid layout, and a power off button appearing when video and audio are not playing. It's rough and ready at the moment. It works fine using direction keys. Mouse users would want to modify the button sizes or maybe overlay buttons to allow for mouse navigation.

    Things I have learned from this process:
    1. VideoWindow takes focus even when not visible
    2. VideoWindow will always render the TV picture at the starting co-ordinates irrespective of animations but....
    3. The VideoWindow can be slid off the screen or out of the way with an animation when not playing using "Hidden" as above
    4. Unfortunately when a button is not visible, MP starts looking for the next alternative button in the direction of travel +/- 1 pixel rather than +/- 0 pixels which would have allowed for buttons to be stacked on top of each other.

    Tomorrow I am going to try out the set focus idea.

    RH
     

    Attachments

    • Screen grab.png
      Screen grab.png
      2.3 MB
    • myHome.xml
      57.1 KB

    Users who are viewing this thread

    Top Bottom