Latest Media Handler - facade properties - itemcount (1 Viewer)

Rob Hexenmeister

MP Donator
  • Premium Supporter
  • May 12, 2011
    207
    49
    Slaithwaite
    Home Country
    United Kingdom United Kingdom
    Good evening all,

    I am customising my BasicHome screen (some of you may remember). Thanks to the excellent help and support this is coming along quite well.. but I have come across a hurdle. I can't find a property that reports back the number of items in facadeview of Latest Media Handler.

    I can use selected item for the name, selected index for the enumerator of the current item, but I can't find anything to tell me how many items there are - I was expecting to use #itemcount but that doesn't work.

    Am I missing something?

    Many thanks
    RH
     

    CyberSimian

    Test Group
  • Team MediaPortal
  • June 10, 2013
    2,836
    1,753
    Southampton
    Home Country
    United Kingdom United Kingdom
    I can use selected item for the name, selected index for the enumerator of the current item, but I can't find anything to tell me how many items there are - I was expecting to use #itemcount but that doesn't work.
    I have not tried using "Latest Media Handler" in my skin, so there may be some specific restrictions that apply. However, #itemcount is notorious for being unset in various circumstances (so you may have found another one).

    Below is the xml that I use to generate the item count string (top left corner in my skin); the comments explain why this logic is necessary:

    <!-- ====================================================================
    The built-in variables "#selectedindex" and "#itemcount" have incorrect
    values on some panels. To avoid bad labelling appearing on the panel, we
    use the following algorithm, where "(null)" represents the zero-length
    string, and "n" and "m" are integers:
    Code:
    #selectedindex  #itemcount  label_shown
       (null)         (null)      (none)
       (null)           0         0 items
       (null)           n         n items
         0            (null)      (none)
         0              0         0 items
         0              n         n items
         n            (null)      Item n
         n              0         Item n
         n              m         Item n/m
    In addition, when the context menu is on the screen, "#selectedindex"
    is the index of the highlighted item in the context menu, and not the
    index of the item in the list. So when the context menu is visible, we
    display the null string or "n items", as appropriate.
    ===================================================================== -->
    <label>#(switch(
    and(eq(#currentmodule,L(102012)),eq(#itemcount,'')),'',
    eq(#currentmodule,L(102012)),'#itemcount items',
    and(eq(#selectedindex,''),eq(#itemcount,'')),'',
    and(eq(#selectedindex,'0'),eq(#itemcount,'')),'',
    or(eq(#selectedindex,''),eq(#selectedindex,'0')),'#itemcount items',
    or(eq(#itemcount,''),eq(#itemcount,'0')),'Item #selectedindex',
    eq(1,1),'Item #selectedindex/#itemcount'))</label>

    So there you have it. Simples! :D

    -- from CyberSimian in the UK
     

    Rob Hexenmeister

    MP Donator
  • Premium Supporter
  • May 12, 2011
    207
    49
    Slaithwaite
    Home Country
    United Kingdom United Kingdom
    Good heavens! Thank you very much

    So that label code is what I want then? My intention was to use #itemcount in a visibility condition for a forward arrow graphic - i.e. if #selectedindex = #itemcount then forward arrow graphic visibility = false.

    RH
     

    CyberSimian

    Test Group
  • Team MediaPortal
  • June 10, 2013
    2,836
    1,753
    Southampton
    Home Country
    United Kingdom United Kingdom
    My intention was to use #itemcount in a visibility condition for a forward arrow graphic - i.e. if #selectedindex = #itemcount then forward arrow graphic visibility = false.
    Hmm, I don't think that the <label> code that I showed is quite what you want. The <label> code is what is needed to generate a sensible item count in the top left corner of the panel. Because "#itemcount" and "#selectedindex" are unreliable, I don't think that you will be able to achieve what you want. :(

    -- from CyberSimian in the UK
     

    Users who are viewing this thread

    Top Bottom