user set targets stop working after changing language
#1
I'm pretty lost on this one.

I implemented the ability to set custom items in my home menu.

In a custom configuration dialog the user clicks one of the custom item buttons. An example of one of these buttons:

PHP Code:
<control type="button" id="103">
    <
width>484</width>
    <
label>Custom Item 1</label>
    <
label2>$INFO[Skin.String(customitem.video1.label)]</label2>
    
        <!--(
re)set category-->
    <
onclick>ClearProperty(customitem.category,Home)</onclick>
    <
onclick>SetProperty(customitem.category,video,Home)</onclick>

    <!--
reset previous item values-->
    <
onclick>Skin.Reset(customitem.video1.path)</onclick>
    <
onclick>Skin.Reset(customitem.video1.type)</onclick>

    <!--
set up new item value-->
    <
onclick>SetProperty(customitem.video.number,1,Home)</onclick>
    <
onclick>ActivateWindow(96)</onclick>
    <include>
dialog_Radio-alt</include>
    <
enable>!Skin.HasSetting(homemenu.videos.disable)</enable>
</
control

Another custom window (96) is opened. Here the user sets the type of item (folder, add-on or playlist)

To keep things clear I'll only show the code used when the user has chosen a folder to be set as custom item, as this is where the problem lies.

The customitem.video1.path string is what we're looking at:

PHP Code:
<onclick condition="StringCompare(Window(Home).Property(customitem.category),video) + StringCompare(Window(Home).Property(customitem.video.number),1)">Skin.Reset(customitem.video1.type)</onclick>
<
onclick condition="StringCompare(Window(Home).Property(customitem.category),video) + StringCompare(Window(Home).Property(customitem.video.number),1)">Skin.Reset(customitem.video1.label)</onclick>
<
onclick condition="StringCompare(Window(Home).Property(customitem.category),video) + StringCompare(Window(Home).Property(customitem.video.number),1)">Skin.SetString(customitem.video1.type,$LOCALIZE[20334])</onclick>
<
onclick condition="StringCompare(Window(Home).Property(customitem.category),video) + StringCompare(Window(Home).Property(customitem.video.number),1)">Skin.SetPath(customitem.video1.path)</onclick>
<
onclick condition="StringCompare(Window(Home).Property(customitem.category),video) + StringCompare(Window(Home).Property(customitem.video.number),1)">Skin.SetString(customitem.video1.label)</onclick

When everything is set, this button is added to the home menu:

PHP Code:
<!--custom video entry 1-->        
<
control type="button" id="103">
    <
label>$INFO[Skin.String(customitem.video1.label)]</label>
    <
onleft>100</onleft>
    <
onback>100</onback>
    <
onclick condition="Skin.String(customitem.video1.type,$LOCALIZE[20334])">ActivateWindow(Videos,$INFO[Skin.String(customitem.video1.path)],return)</onclick>
    <
onclick condition="Skin.String(customitem.video1.type,$LOCALIZE[559])">ActivateWindow(VideoLibrary,$INFO[Skin.String(customitem.video1.playlistpath)],return)</onclick>
    <
onclick condition="Skin.String(customitem.video1.type,$LOCALIZE[24000])">RunAddon($INFO[Skin.String(customitem.video1.addonpath)])</onclick>
    <include>
home_SubMenuButton</include>
    <
visible>!IsEmpty(Skin.String(customitem.video1.label)) + [Control.HasFocus(1111) | Control.HasFocus(103) | Skin.String(HomeSub,$LOCALIZE[3])]</visible>
</
control

And everything works perfectly... Until the XBMC system language is changed, said button will not open the user specified path anymore.

I added a label control on home to display "customitem.video1.path" just to be sure, and it shows the correct path.

I am not using any non-localized strings here, and certainly not in the path. Guess I am overlooking something really simple but I can't seem to find it.

Hopefully someone can make sense out of the snippets Rolleyes
Reply
#2
I remember well trying to get my head around a similar problem myself. Basically - don't use localised strings here.

If I understand XBMC correctly, when you SetString, it saves the localised form of the string in whatever language the user is currently using. If you then change language, your StringCompare is comparing the localised form in the previous language against the current language and so they don't match, and the OnClick won't run.
Reply
#3
Hm, and there I was thinking explicitly making it localized was the sensible thing to do Tongue
Reply
#4
Removed the localised strings, and all keeps working when changing language Smile Cheers!
Reply

Logout Mark Read Team Forum Stats Members Help
user set targets stop working after changing language0