dynamically changing height of list???
#1
I'm trying to adjust the height of a list depending on the type of Season art i want to show, either poster or landscape.

This is what i managed so far:
Originally in this view they did not show any of the season art. So i created two different image controls that will display the Season art or revert to Show art if no Season art is available. Did this for Poster and Landscape. This all works and i can change which image is visible by changing the visible property.

Next thing i tried was to make the correct image appear depending on a variable set by my (Eventually i will try to turn this into a skin setting). Here i already ran into problems Smile

This is the syntax i used to make the variable
xml:

    <!-- Variable for choice between Season Landscape or Poster Try to turn this into a skin property later-->
    <variable name="View525SeasonLandscapeOrPoster">
        <!-- <value>poster</value> -->
        <value>landscape</value>
    </variable>

my idea was that whatever i put there as value can be read later by using $VAR[View525SeasonLandscapeOrPoster], like this:

xml:

            <!-- Season Landscape -->
            <control type="image">
                <visible>String.Contains($VAR[View525SeasonLandscapeOrPoster],landscape)</visible>
                <left>150</left>
                <width>550</width>
                <height>305</height>
                <bottom>50</bottom>
                <aspectratio aligny="center" align="left">keep</aspectratio>
                <include condition="!String.Contains(Skin.String(SkinHelper.StudioLogos.Path),colo)">videoInfoColorDiffuse</include>
                <texture background="true">$VAR[View525SeasonOrShowLandscape]</texture>
            </control>

But that doesn't seem to work, to get around that i created a label with ID set the visible to false and just set the label to landscape or poster, but that makes the variable obsolete.

xml:

            <!-- Hidden Label for Landscape/Poster choice -->
            <control type="label" id="12345">
                <visible>false</visible>
                <left>50</left>
                <width>100</width>
                <height>40</height>
                <bottom>50</bottom>
                <label>poster</label>
            </control>            

changing the visible tag in the image to this made it work as expected:
 
xml:

<visible>String.Contains(Control.GetLabel(12345),landscape)</visible>

So now i can change the layout depending on what it type in the "hidden" label

The result looks like this for poster:
Image

And like this for landscape:
Image

So now we are getting to the problem im struggling with. There is much more space when you use the landscape view so i wanted to extend the season list back to 5 rows when using landscape and 4 rows for poster(originally there were 7 rows)

Ive tried to add a condition the the height just like above for making the images visible,  but that didn't work

xml:

<height condition="String.Contains(Control.GetLabel(12345),poster)">260</height>
<height condition="String.Contains(Control.GetLabel(12345),landscape)">325</height>

Then i tried a variable again and some includes:

xml:

    <!-- Variable for Height of SeListItem   For now i manually set height here-->
    <variable name="SeasonListHeight">
        <value>325</value>
        <value>260</value>
    </variable>
    
    <!-- Height for Poster View -->
    <include name="View525_PosterHeight">
        <height>260</height>
    </include>
        <!-- Height for Landscape View -->
    <include name="View525_LandscapeHeight">
        <height>325</height>
    </include>

And tried to use it like this, but again no luck

xml:

<height>$VAR[SeasonListHeight]</height>

<include condition="String.Contains(Control.GetLabel(12345),poster)">View525_PosterHeight</include>
<include condition="String.Contains(Control.GetLabel(12345),landscape)">View525_LandscapeHeight</include>


Nothing of what i tried so far seems to work. Can anybody shed any light on what i might be doing wrong.

Here you can see the layout of part i'm trying to edit:

Image
 
Below is more detail of the list and the height i would like to change:

Image

Sorry for the massively long post but i wanted to give as much info as possible since i'm still very new at all this
Reply
#2
Vars are very, very strange beasts that only work certain places (it has to do with when certain things are rendered by the render engine).  If you're used to using variables in programming, forget everything you know.  It will only confuse you (trust me, I know from experience).  From the Kodi wiki:

"Variables can be used in any tag that supports infolabels, like the texture, label and visible tags." (and I think that visible tag thing might not be true, but you can do that with expressions)

https://kodi.wiki/view/Skinning_Manual#Variables

You can't use them for things like height and width.  You might look at conditional includes, because you can do something like:

xml:

<include name="WideWidth">
    <width>1000</width>
</include>

Which you can then include conditionally like:

xml:

<include content="WideWidth" condition="[your condition here]" />

BTW, I did not check my example, so if you copy and paste it and it doesn't work, think of it as more of a direction than an actual help.
Reply
#3
(2020-06-27, 04:40)pkscout Wrote: Vars are very, very strange beasts that only work certain places (it has to do with when certain things are rendered by the render engine).  If you're used to using variables in programming, forget everything you know.  It will only confuse you (trust me, I know from experience).  From the Kodi wiki:

"Variables can be used in any tag that supports infolabels, like the texture, label and visible tags." (and I think that visible tag thing might not be true, but you can do that with expressions)

https://kodi.wiki/view/Skinning_Manual#Variables

You can't use them for things like height and width.  You might look at conditional includes, because you can do something like:

xml:

<include name="WideWidth">
    <width>1000</width>
</include>

Which you can then include conditionally like:

xml:

<include content="WideWidth" condition="[your condition here]" />

BTW, I did not check my example, so if you copy and paste it and it doesn't work, think of it as more of a direction than an actual help.
Hi, thanks for your reply.

I've already tried that in combination with the same condition that works for my first problem, where i check for the value of the hidden label.
Sadly enough no luck with that option either.
Reply
#4
I looked through your screenshots of the code, and I don't see anytime you used the syntax I showed.  Specifically note that the syntax for the include to work right uses:

xml:
<include content="NAMEOFINCLUDE" condition="BOOLEANCONDITION" />

NOT

xml:
<include condition="BOOLEANCONDITION">NAMEOFINCLUDE</include>

I have found that can make a difference between working and not working.  As a side note, you can't use conditionals with every tag.  I saw you tried conditionals in the height tag, for instance.  That definitely won't work.

So with one of your examples, I would try:

xml:
<include content="View525_PosterHeight" condition="String.Contains(Control.GetLabel(12345),poster)" />
Reply

Logout Mark Read Team Forum Stats Members Help
dynamically changing height of list???0