I have a
fixedlist
control of about 800 lines which I want to display with different heights, based on
Container.Content
. Normally, I would have used conditional includes but since includes cannot resolve
Container.Content
, I am in need of a different approach.
Many years ago,
the only way was to have different controls for each condition, but I am hoping that someone has identified a better way; I would hate to have to duplicate 800 lines of definition.
It's still valid. Happy duplicating
But you can use the param feature.
https://kodi.wiki/view/Skinning_Manual#Nested
Definition
Code:
<include name="MyFixedlist">
<param name="height">800</heigth>
<definition>
<control type="fixedlist">
<height>$PARAM[height]</height>
...
..
</control>
</definition>
</include>
Call
Code:
<include content="MyFixedlist" condition="Container.Content(movies)">
<param name="height" value="500"/>
</include>
<include content="MyFixedlist" condition="Container.Content(tvshows)">
<param name="height" value="600"/>
</include>
<include content="MyFixedlist" condition="Container.Content(music)">
<param name="height" value="900"/>
</include>
...
Thanks @
sualfred for replying. I did what you proposed:
xml:
<?xml version="1.0" encoding="UTF-8"?>
<includes>
<include name="VideoLowList">
<control type="group">
...
<include content="LowListFixedList" condition="Container.Content(episodes)">
<param name="height">517</param>
<param name="movement">6</param>
</include>
<include content="LowListFixedList" condition="!Container.Content(episodes)">
<param name="height">347</param>
<param name="movement">4</param>
</include>
</control>
</include>
<include name="LowListFixedList">
<param name="height">517</param>
<param name="movement">6</param>
<definition>
<height>$PARAM[height]</height>
<movement>$PARAM[movement]</movement>
....
</definition>
</include>
</includes>
Sadly it didn't work.
Container.Content(episodes)
is always evaluated as
false
and the 347 is used for
height
.
Could it be related to this? Am I doing something wrong?
PS to bypass the limitation of
include
, I tried to employ a hack by setting a
label
string and checking its value in the
condition
attribute; that didn't work either.
I don't know your complete code and structure, but I guess it happened when you were on a tv show or season level before.
Kodi does not render the includes in the media windows again when the page content is changed to episodes or to any other path. It just updates the container path. In that case you have to work with visible conditions, conditional item and focused layouts and/or additional view types.
That is what I deduced too. To summarize:
- Skins cannot use conditions for
height
.- To work around that, conditional includes can be employed but skins cannot use
Container
in the condition
attribute of include
s.- To work around that, skins need to use multiple
include
s and manage with the visible
attribute but if their controls have id
s things fall apart.- To work around that, skinners need to change the
id
s and over-complicate every condition where that id
is used
- Another workaround is to simply create entirely different views which only differ in one control's height; they would name them LowList Short, LowList Tall, LowList Medium!
Meaning skins cannot have dynamic heights for different
Container.Content
without drastically complicating the markup. No wonder @
phil65 was
begging for it.
Has anyone come up with a better way of doing this? Do you know a skin that has succeeded in solving this problem differently?
Wrong, My Example works if a window is going to reload. You can try it on your own by going to a epsiode level and force the skin to reload.
It's pretty much easy to get it working for you. Just define another view for each wanted and possible height.
Code:
<control type="fixedlist" id="50">
<visible>Container.Content(episodes)</visible>
<height>500</height>
<include content="Layout">
<param name="ID" value="50"/>
.... (and other required params) ....
</include>
</control>
<control type="fixedlist" id="51">
<visible>!Container.Content(episodes)</visible>
<height>700</height>
<include content="Layout">
<param name="ID" value="51"/>
.... (and other required params) ....
</include>
</control>
I think I got what you mean; correct me please if I misunderstood. You are proposing to either use separate views, or pass the id
down.
I was hoping not to have to duplicate an entire view just for a height difference. On passing down using params, unfortunately the conditions that check the view are not inside the fixedlist but rather outside it in different xml files; does the param I set here get to them?
PS for now I just duplicated the id
s and changed all my conditions. It would be a nightmare to manage this and I am hoping to find a cleaner solution.
In my example you don't have to duplicate codes. Just include the layout code and use params to provide the ID to change conditions for all Container($PARAM[id]).xxx.xxx values.
Thanks. I will try your proposal over the weekend and will report back.