PSA on $PARAM declarations
#1
This might be common knowledge, but something that was causing me to go slightly crazy at times over the past few years and I never knew what was going on...

I have a default param value in an include and then pass that include with params into another include etc, like so:

xml:

<include name="Example_Include_Template">
    <param name="left" default="30" />
    <definition>
        <control type="group">
            <left>$PARAM[left]</left>
            ...
        </control>
    </definition>
</include>

<include name="Example_Include_Layout">
    <include content="Example_Include_Template">
        <param name="left" value="$PARAM[left]" />
        ....
    </include>
</include>

<include name="Example_Include_List">
    <param name="left" />
    <definition>
        <include content="Example_Include_Layout">
            <param name="left" value="$PARAM[left]" />
            ...
        </include>
    </definition>
</include>
 
If I define the parameter left in "Example_Include_List", it should apply that new value to the left value of the group control in "Example_Include_Template". If I don't define the parameter left, it should keep the default value of "30" defined in "Example_Include_Template".

Sometimes this wouldn't work for me and I never knew why until today.

In "Example_Include_List", at the top where the params are, I have "<param name="left" />
I thought this was a way for me to easily keep track of all the params I have in an include but doesn't do anything because it doesn't have a default tag. But now I realise it's the same as putting it to 0 or empty value or whatever. So this line is actually overriding the default value of "30" and replacing it with "0".

Huh, I never knew that!
Reply
#2
Hehe, never "trapped" into that, but good to know!

BTW: Your code examples with that hidden on-focus Button, was EXTREMLY useful for me, this works crazy good, immediate reaction of Kodi. So one more time: Thanks for your reply! (Also your code is very clean structured, you wouldn't believe my python/XML mess here Wink )
Reply
#3
(2024-09-02, 20:44)iceman20k Wrote: Hehe, never "trapped" into that, but good to know!

BTW: Your code examples with that hidden on-focus Button, was EXTREMLY useful for me, this works crazy good, immediate reaction of Kodi. So one more time: Thanks for your reply! (Also your code is very clean structured, you wouldn't believe my python/XML mess here Wink )

Haha thanks, to be fair, I've refactored this a number of times over the years as I've come across better ways of doing things. Mild OCD helps too, but it's mainly because I often have to leave long periods between looking at the code when life responsibilities get in the way and then I don't understand it when I come back to it unless I make it as obvious as possible. I've recently started adding more comments after deleting things that seemed extraneous, only to later realise they were workarounds for some of the quirks and bugs in the Kodi engine
Reply

Logout Mark Read Team Forum Stats Members Help
PSA on $PARAM declarations0