home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 1
MediaPortal 1 Skins
Popular Skins
PureVision
PureVisionHD 1080
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="CyberSimian" data-source="post: 1291978" data-attributes="member: 141969"><p>The skin engine <em>does</em> provide this information, but with quirks. The following screen shot is for the "Recorded Radio" panel in my "Clarity" skin (the "Recorded TV" panel is the same, as I use common code for both panels):</p><p></p><p>[ATTACH]211371[/ATTACH]</p><p></p><p>However, the quirks are that the values are sometimes unset, and sometimes set incorrectly. So to get a sensible outcome in all cases, it is necessary to use some complicated logic. This is what I use:</p><p></p><p>[code] <control></p><p> <description>Number of items in a list</description></p><p> <type>label</type></p><p> <posX>0</posX></p><p> <posY>#cw.nlist.count.y</posY></p><p> <width>#cw.panel.w</width></p><p> <height>#cw.nlist.count.h</height></p><p> <align>center</align></p><p> <font>#cw.nlist.count.f</font></p><p> <textcolor>#cw.nlist.count.c</textcolor></p><p> <description></p><p> The built-in variables "#selectedindex" and "#itemcount" are unset</p><p> or incorrectly set in certain situations. To avoid bad labelling</p><p> appearing on the panel, we display the values shown below, where</p><p> "(null)" represents the zero-length string, and "n" and "m" are</p><p> integers:</p><p> ~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~~</p><p> #selectedindex #itemcount label shown</p><p> ~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~~</p><p> (null) (null) (none)</p><p> (null) 0 0 items</p><p> (null) 1 1 item</p><p> (null) n n items</p><p> 0 (null) (none)</p><p> 0 0 0 items</p><p> 0 1 1 item</p><p> 0 n n items</p><p> n (null) Item n</p><p> n 0 Item n</p><p> n 1 Item 1</p><p> n m Item n of m</p><p> ~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~~</p><p> In addition, when the context menu is on the screen, "#selectedindex"</p><p> is the index of the highlighted item in the context menu, and not the</p><p> index of the item in the list. So when the context menu is visible</p><p> (language string: 102012), we display the null string or "n items",</p><p> as appropriate.</p><p> </description></p><p> <label>#(switch(</p><p> and(eq(#currentmodule,L(102012)),eq(#itemcount,'')),</p><p> '',</p><p> eq(#currentmodule,L(102012)),</p><p> string.formatcount(</p><p> #itemcount,'{0} items|{0} item|{0} items'),</p><p> and(eq(#selectedindex,''),eq(#itemcount,'')),</p><p> '',</p><p> and(eq(#selectedindex,'0'),eq(#itemcount,'')),</p><p> '',</p><p> or(eq(#selectedindex,''),eq(#selectedindex,'0')),</p><p> string.formatcount(</p><p> #itemcount,'{0} items|{0} item|{0} items'),</p><p> or(eq(#itemcount,''),eq(#itemcount,'0')),</p><p> 'Item #selectedindex',</p><p> eq(1,1),</p><p> 'Item #selectedindex of #itemcount'))</label></p><p> </control>[/code]</p><p></p><p>Note that some of the text constants are hard-coded English, so if you wanted to enable your skins for other languages, you would need to modify those parts of the code.</p><p></p><p>-- from CyberSimian in the UK</p></blockquote><p></p>
[QUOTE="CyberSimian, post: 1291978, member: 141969"] The skin engine [i]does[/i] provide this information, but with quirks. The following screen shot is for the "Recorded Radio" panel in my "Clarity" skin (the "Recorded TV" panel is the same, as I use common code for both panels): [ATTACH]211371[/ATTACH] However, the quirks are that the values are sometimes unset, and sometimes set incorrectly. So to get a sensible outcome in all cases, it is necessary to use some complicated logic. This is what I use: [code] <control> <description>Number of items in a list</description> <type>label</type> <posX>0</posX> <posY>#cw.nlist.count.y</posY> <width>#cw.panel.w</width> <height>#cw.nlist.count.h</height> <align>center</align> <font>#cw.nlist.count.f</font> <textcolor>#cw.nlist.count.c</textcolor> <description> The built-in variables "#selectedindex" and "#itemcount" are unset or incorrectly set in certain situations. To avoid bad labelling appearing on the panel, we display the values shown below, where "(null)" represents the zero-length string, and "n" and "m" are integers: ~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~~ #selectedindex #itemcount label shown ~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~~ (null) (null) (none) (null) 0 0 items (null) 1 1 item (null) n n items 0 (null) (none) 0 0 0 items 0 1 1 item 0 n n items n (null) Item n n 0 Item n n 1 Item 1 n m Item n of 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 (language string: 102012), we display the null string or "n items", as appropriate. </description> <label>#(switch( and(eq(#currentmodule,L(102012)),eq(#itemcount,'')), '', eq(#currentmodule,L(102012)), string.formatcount( #itemcount,'{0} items|{0} item|{0} items'), and(eq(#selectedindex,''),eq(#itemcount,'')), '', and(eq(#selectedindex,'0'),eq(#itemcount,'')), '', or(eq(#selectedindex,''),eq(#selectedindex,'0')), string.formatcount( #itemcount,'{0} items|{0} item|{0} items'), or(eq(#itemcount,''),eq(#itemcount,'0')), 'Item #selectedindex', eq(1,1), 'Item #selectedindex of #itemcount'))</label> </control>[/code] Note that some of the text constants are hard-coded English, so if you wanted to enable your skins for other languages, you would need to modify those parts of the code. -- from CyberSimian in the UK [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
MediaPortal 1 Skins
Popular Skins
PureVision
PureVisionHD 1080
Contact us
RSS
Top
Bottom