Weird onclick condition behaviour
#1
Hi,

I have some strange behaviours with some conditional onclicks and I have no idea why some work and others not. For example this radio button is working fine:

PHP Code:
<control type="radiobutton">
    [...]
    <
onclick condition="!stringcompare(Skin.String(HomeWidget.1.Method),Random)">Skin.SetString(HomeWidget.1.Method,Random)</onclick>
    <
onclick condition="stringcompare(Skin.String(HomeWidget.1.Method),Random)">Skin.SetString(HomeWidget.1.Method,Last)</onclick>
    <
selected>stringcompare(Skin.String(HomeWidget.1.Method),Random)</selected>
</
control

However if I change it to this, it's not working anymore:

PHP Code:
<control type="radiobutton">
    [...]
    <
onclick condition="!stringcompare(Skin.String(HomeWidget.1.Method),True)">Skin.SetString(HomeWidget.1.Method,True)</onclick>
    <
onclick condition="stringcompare(Skin.String(HomeWidget.1.Method),True)">Skin.SetString(HomeWidget.1.Method,False)</onclick>
    <
selected>stringcompare(Skin.String(HomeWidget.1.Method),True)</selected>
</
control

It can be solved by using substring instead of stringcompare but that doesn't explain why the first one works and the second doesn't. The next example is not working at all (also not with substring):

PHP Code:
<control type="radiobutton">
    [...]
    <
onclick condition="stringcompare(Skin.String(HomeWidget.1.Method),Last)">Skin.SetString(HomeWidget.1.Method,Random)</onclick>
    <
onclick condition="stringcompare(Skin.String(HomeWidget.1.Method),Random)">Skin.SetString(HomeWidget.1.Method,Last)</onclick>
    <
selected>stringcompare(Skin.String(HomeWidget.1.Method),Random)</selected>
</
control

Does anyone have any clue why this isn't working as expected? Am I doing anything wrong?

Thanks.
Image
Reply
#2
using 'True' in a stringcompare never worked.
that's al i know :-)
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#3
Than that should be fixed imo. Smile
Image
Reply
#4
(2013-04-21, 13:17)`Black Wrote:
PHP Code:
<control type="radiobutton">
    [...]
    <
onclick condition="!stringcompare(Skin.String(HomeWidget.1.Method),True)">Skin.SetString(HomeWidget.1.Method,True)</onclick>
    <
onclick condition="stringcompare(Skin.String(HomeWidget.1.Method),True)">Skin.SetString(HomeWidget.1.Method,False)</onclick>
    <
selected>stringcompare(Skin.String(HomeWidget.1.Method),True)</selected>
</
control
Problem here is, that "True" or "False" internally is translated into infobool (either SYSTEM_ALWAYS_TRUE or SYSTEM_ALWAYS_FALSE) but it isn't translated back into "true" or "false" string in comparison - will fix that.

(2013-04-21, 13:17)`Black Wrote:
PHP Code:
<control type="radiobutton">
    [...]
    <
onclick condition="stringcompare(Skin.String(HomeWidget.1.Method),Last)">Skin.SetString(HomeWidget.1.Method,Random)</onclick>
    <
onclick condition="stringcompare(Skin.String(HomeWidget.1.Method),Random)">Skin.SetString(HomeWidget.1.Method,Last)</onclick>
    <
selected>stringcompare(Skin.String(HomeWidget.1.Method),Random)</selected>
</
control
I guess that "HomeWidget.1.Method" isn't never assigned with any value so none of onclick conditions will be true here. We would need way to define first/default value for skin string to do it this way.
Always read the XBMC online-manual, FAQ and search the forums before posting.
Do NOT e-mail Team-XBMC members asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting, make sure you read this first

My previous forum/trac nickname: grajen3
Reply
#5
I have set it to "Last" so it should work (default/first value for a string would indeed be nice)... but I guess it's the same problem as with the fake spin controls. Changing it to

PHP Code:
<control type="radiobutton">
    [...]
    <
onclick condition="stringcompare(Skin.String(HomeWidget.1.Method),Last)">Skin.SetString(HomeWidget.1.Method,Random)</onclick>
    <
onclick condition="stringcompare(Skin.String(HomeWidget.1.Method),Random)">Skin.SetString(HomeWidget.1.Method,Last)</onclick>
    <
onclick condition="stringcompare(Skin.String(HomeWidget.1.Method),Last)">Skin.SetString(HomeWidget.1.Method,Random)</onclick>
    <
selected>stringcompare(Skin.String(HomeWidget.1.Method),Random)</selected>
</
control

fixes it. So you always have to have the same condition in the first and last position, otherwise it either works just one time or not at all. Thanks for the clarification with true/false.
Image
Reply
#6
(2013-04-21, 19:09)`Black Wrote: I have set it to "Last" so it should work (default/first value for a string would indeed be nice)... but I guess it's the same problem as with the fake spin controls. Changing it to

PHP Code:
<control type="radiobutton">
    [...]
    <
onclick condition="stringcompare(Skin.String(HomeWidget.1.Method),Last)">Skin.SetString(HomeWidget.1.Method,Random)</onclick>
    <
onclick condition="stringcompare(Skin.String(HomeWidget.1.Method),Random)">Skin.SetString(HomeWidget.1.Method,Last)</onclick>
    <
onclick condition="stringcompare(Skin.String(HomeWidget.1.Method),Last)">Skin.SetString(HomeWidget.1.Method,Random)</onclick>
    <
selected>stringcompare(Skin.String(HomeWidget.1.Method),Random)</selected>
</
control

fixes it. So you always have to have the same condition in the first and last position, otherwise it either works just one time or not at all.
Ok, this is something else than I thought: if HomeWidget.1.Method is set to Last then first <onclick> will be executed -> skin string is set to "Random" now. After first onclick was executed we check next onclick condition which will be true now too and so we set skin string back to "last". To solve this we should propably evaluate conditions first and after that execute onclick actions in one go.
Always read the XBMC online-manual, FAQ and search the forums before posting.
Do NOT e-mail Team-XBMC members asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting, make sure you read this first

My previous forum/trac nickname: grajen3
Reply
#7
PR2810 takes care of the <onclick> stuff.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#8
(2013-06-02, 09:15)jmarshall Wrote: PR2810 takes care of the <onclick> stuff.
Merged. In new builds this issue should be solved.
Always read the XBMC online-manual, FAQ and search the forums before posting.
Do NOT e-mail Team-XBMC members asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting, make sure you read this first

My previous forum/trac nickname: grajen3
Reply
#9
Any chance to get StringCompare and true problem corrected?
It's quite deep pit for inexperienced skinners Smile
Reply

Logout Mark Read Team Forum Stats Members Help
Weird onclick condition behaviour0