Kodi Community Forum

Full Version: Please help me toggle between 3 states (TopMenuButton)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Togglen between 2 states is very easy with "hassetting" and "visible". But togglen between 3 or more states I just have my problems.

I've ever brought together a toggle function between 3 states, but could not reproduce it.
It just does not work, the toggle button does not show anything, it's empty and nothing works. What am I doing wrong?

There are several ways to implement something.
I tried 2 options, none worked.

FIRST TRY

IncludeVariables:

      
Code:
 <variable name="PLCharacterLabel">
        <value condition="String.IsEqual(Control.GetLabel(92134),character)">character</value>
        <value condition="String.IsEqual(Control.GetLabel(92134),multicharacter)">multicharacter</value>
        <value condition="String.IsEqual(Control.GetLabel(92134),nocharacter)">nocharacter</value>
    </variable>


IncludesTopMenu:

Code:
                <control type="button" id="92129">
                    <include>TopMenuButton</include>
                    <label>CHARACTERART:</label>
                    <label2>$VAR[PLCharacterLabel]</label2>
                    <onclick condition="Container.Content(tvshows)">SetProperty(Area,TVShows,home)</onclick>                    
                    <onclick condition="String.IsEqual(Control.GetLabel(92134),nocharacter)">Skin.SetString(PosterLite$INFO[Window(home).Property(Area)],character)</onclick>
                    <onclick condition="String.IsEqual(Control.GetLabel(92134),character)">Skin.SetString(PosterLite$INFO[Window(home).Property(Area)],multicharacter)</onclick>
                    <onclick condition="String.IsEqual(Control.GetLabel(92134),multicharacter)">Skin.SetString(PosterLite$INFO[Window(home).Property(Area)],nocharacter)</onclick>                    
                    <visible>Control.IsVisible(69) + Container.Content(tvshows)</visible>
                </control>

SECOND TRY

IncludeVariables:

Code:
    <variable name="PLCharacterLabel1">
        <value condition="Skin.HasSetting(character)">character</value>
        <value condition="Skin.HasSetting(multicharacter)">multicharacter</value>        
        <value condition="Skin.HasSetting(nocharacter)">nocharacter</value>
    </variable> 
   

IncludesTopMenu:

                    
Code:
<control type="button" id="92130">
                    <label>CHARACTERART:</label>
                    <label2>$VAR[PLCharacterLabel1]</label2>
                    <include>TopMenuButton</include>                    
                    <onclick condition="Skin.HasSetting(nocharacter)">Skin.SetBool(character)</onclick>
                    <onclick condition="Skin.HasSetting(nocharacter)">Skin.Reset(nocharacter)</onclick>
                    <onclick condition="Skin.HasSetting(character)">Skin.SetBool(multicharacter)</onclick>
                    <onclick condition="Skin.HasSetting(character)">Skin.Reset(character)</onclick>
                    <onclick condition="Skin.HasSetting(multicharacter)">Skin.SetBool(nocharacter)</onclick>
                    <onclick condition="Skin.HasSetting(multicharacter)">Skin.Reset(multicharacter)</onclick>                            
                    <visible>Control.IsVisible(69) + Container.Content(tvshows)</visible>
                </control> 
   

__________________

I would be very grateful if someone could help me what I'm doing wrong, I would also thankful invite you to Teamviewer to help me on the jumps.
(2019-02-07, 17:35)chrissix Wrote: [ -> ]IncludesTopMenu:
Code:
<control type="button" id="92130">
                    <label>CHARACTERART:</label>
                    <label2>$VAR[PLCharacterLabel1]</label2>
                    <include>TopMenuButton</include>                    
                    <onclick condition="Skin.HasSetting(nocharacter)">Skin.SetBool(character)</onclick>
                    <onclick condition="Skin.HasSetting(nocharacter)">Skin.Reset(nocharacter)</onclick>
                    <onclick condition="Skin.HasSetting(character)">Skin.SetBool(multicharacter)</onclick>
                    <onclick condition="Skin.HasSetting(character)">Skin.Reset(character)</onclick>
                    <onclick condition="Skin.HasSetting(multicharacter)">Skin.SetBool(nocharacter)</onclick>
                    <onclick condition="Skin.HasSetting(multicharacter)">Skin.Reset(multicharacter)</onclick>                            
                    <visible>Control.IsVisible(69) + Container.Content(tvshows)</visible>
                </control> 
   

__________________

I would be very grateful if someone could help me what I'm doing wrong, I would also thankful invite you to Teamviewer to help me on the jumps.
Use skin.string insted Skin.HasSetting
like this Smile
Code:
<control type="button" id="92130">
     <label>CHARACTERART:</label>
     <label2>$VAR[PLCharacterLabel1]</label2>
     <include>TopMenuButton</include>  
     <onclick condition="String.IsEqual(skin.string(fullscreen_icon,character))">Skin.SetString(fullscreen_icon,multicharacter)</onclick>
     <onclick condition="String.IsEqual(skin.string(fullscreen_icon,multicharacter))">Skin.SetString(fullscreen_icon,nocharacter)</onclick>
     <onclick condition="String.IsEqual(skin.string(fullscreen_icon,multicharacter))|String.IsEmpty(skin.string(fullscreen_icon))">Skin.SetString(fullscreen_icon,character)</onclick>
                         
     <visible>Control.IsVisible(69) + Container.Content(tvshows)</visible>
                </control> 
IncludeVariables:
Code:
<variable name="PLCharacterLabel1">
<value condition="String.IsEqual(skin.string(fullscreen_icon,character))">character</value>
<value condition="String.IsEqual(skin.string(fullscreen_icon,multicharacter))">multicharacter</value>
<value condition="String.IsEqual(skin.string(fullscreen_icon,nocharacter))">nocharacter</value>
</variable>
(2019-02-07, 18:16)Angelinas Wrote: [ -> ]<onclick condition="String.IsEqual(skin.string(fullscreen_icon,character))">Skin.SetString(fullscreen_icon,multicharacter)</onclick>
                    <onclick condition="String.IsEqual(skin.string(fullscreen_icon,multicharacter))">Skin.SetString(fullscreen_icon,nocharacter)</onclick>
                    <onclick condition="String.IsEqual(skin.string(fullscreen_icon,multicharacter))|String.IsEmpty(skin.string(fullscreen_icon))">Skin.SetString(fullscreen_icon,character)</onclick>

Added to your ready example the matching value conditions then in includesvariables, the only progress was that the button instead of empty now displays "character" (the 1st value), but still no toggling ...


Play me for hours and still can not get it. Out of sheer frustration, I have now tried to copy your code 1:1 from your skin cause i thought that had to work for testing...

Includesvariables:

Code:
<variable name="PLPlusIconLabelFullVar">
<value condition="String.IsEqual(skin.string(fullscreen_icon),logo)">Logo</value>
<value condition="String.IsEqual(skin.string(fullscreen_icon),clearart)">Clearart</value>
<value condition="String.IsEqual(skin.string(fullscreen_icon),fanart)">Fanart</value>
<value condition="String.IsEqual(skin.string(fullscreen_icon),banner)">Banner</value>
<value condition="String.IsEqual(skin.string(fullscreen_icon),discart)">Discart</value>
<value condition="String.IsEqual(skin.string(fullscreen_icon),characterart)">Characterart</value>
<value condition="String.IsEqual(skin.string(fullscreen_icon),noicon)"/>
</variable>

IncludesTopMenu:

Code:
​​​​​​​                <control type="button" id="92149">
                    <include>TopMenuButton</include>
                    <label>DialogSeekBar Art</label>
                    <label2>$VAR[PLPlusIconLabelFullVar]</label2>
                    <onclick condition="String.IsEqual(skin.string(fullscreen_icon),noicon) | String.IsEmpty(skin.string(fullscreen_icon))">Skin.SetString(fullscreen_icon,logo)</onclick>
                    <onclick condition="String.IsEqual(skin.string(fullscreen_icon),logo)">Skin.SetString(fullscreen_icon,discart)</onclick>
                    <onclick condition="String.IsEqual(skin.string(fullscreen_icon),discart)">Skin.SetString(fullscreen_icon,banner)</onclick>
                    <onclick condition="String.IsEqual(skin.string(fullscreen_icon),banner)">Skin.SetString(fullscreen_icon,fanart)</onclick>
                    <onclick condition="String.IsEqual(skin.string(fullscreen_icon),fanart)">Skin.SetString(fullscreen_icon,clearart)</onclick>
                    <onclick condition="String.IsEqual(skin.string(fullscreen_icon),clearart)">Skin.SetString(fullscreen_icon,characterart)</onclick>
                    <onclick condition="String.IsEqual(skin.string(fullscreen_icon),characterart)">Skin.SetString(fullscreen_icon,noicon)</onclick>
                </control>

The code is now copied from you 1: 1 and it remains empty, have already tried ID's and VAR names to change ... how is that possible
____

The toggle button must also work without having visible conditions in the Views.xml's. Or? I would do that after the button finally works.
sorry I post wrong brackets in code Sad
Code:
<variable name="PLCharacterLabel1">
<value condition="String.IsEqual(Skin.String(fullscreen_icon),character)">character</value>
<value condition="String.IsEqual(Skin.String(fullscreen_icon),multicharacter)">multicharacter</value>
<value condition="String.IsEqual(Skin.string(fullscreen_icon),nocharacter)">nocharacter</value>
</variable>
 
Code:
                <control type="button" id="92130">
                    <label>CHARACTERART::</label>
                    <label2>$VAR[PLCharacterLabel1]</label2>
                    <include>TopMenuButton</include>  
                    <onclick condition="String.IsEqual(skin.string(fullscreen_icon),character)">Skin.SetString(fullscreen_icon,multicharacter)</onclick>
                    <onclick condition="String.IsEqual(skin.string(fullscreen_icon),multicharacter)">Skin.SetString(fullscreen_icon,nocharacter)</onclick>
                    <onclick condition="String.IsEqual(skin.string(fullscreen_icon),nocharacter)|String.IsEmpty(skin.string(fullscreen_icon))">Skin.SetString(fullscreen_icon,character)</onclick>
                    <visible></visible>
                </control>
@Angelinas 

Thank You, Thank You, Thank You!

Previously, I used this spelling syntax:

Code:
                    <control type="button" id="9216257">
                    <label>POSTER LAYOUT</label>
                    <label2>$VAR[RightListPosterLayout]</label2>
                    <include>TopMenuButton</include>                    
                    <onclick condition="Skin.HasSetting(Poster)">Skin.SetBool(Postercase)</onclick>
                    <onclick condition="Skin.HasSetting(Poster)">Skin.Reset(Poster)</onclick>
                    <onclick condition="Skin.HasSetting(Postercase)">Skin.SetBool(ShowKeyart)</onclick>
                    <onclick condition="Skin.HasSetting(Postercase)">Skin.Reset(Postercase)</onclick>
                    <onclick condition="Skin.HasSetting(ShowKeyart)">Skin.SetBool(Poster)</onclick>
                    <onclick condition="Skin.HasSetting(ShowKeyart)">Skin.Reset(ShowKeyart)</onclick>                
                    <visible>Control.IsVisible(51) + [Container.Content(movies) | Container.Content(sets)]</visible>
                </control>  

 Once it worked. But since your code did not work so well at first I tried to use this code (above) a second time. This also destroyed this (above) toggle.
Maybe it worked only first time cause some kind of glitch.

With your code I could do it right now:
Code:
                        <control type="button" id="9216257">
                    <label>POSTER LAYOUT</label>
                    <label2>$VAR[RightListPosterLayout]</label2>
                    <include>TopMenuButton</include>  
                    <onclick condition="String.IsEqual(skin.string(poster_toggle),Poster)">Skin.SetString(poster_toggle,Postercase)</onclick>
                    <onclick condition="String.IsEqual(skin.string(poster_toggle),Postercase)">Skin.SetString(poster_toggle,Keyart)</onclick>
                    <onclick condition="String.IsEqual(skin.string(poster_toggle),Keyart)|String.IsEmpty(skin.string(poster_toggle))">Skin.SetString(poster_toggle,Poster)</onclick>
                    <visible>Control.IsVisible(51) + [Container.Content(movies) | Container.Content(sets)]</visible>
                </control>  
 

At first, that did not work either. I had to play around with the spelling. Have you already experienced that not all words / spellings are particularly large and capitalized?
What i mean:

"String.IsEqual(skin.string(poster_toggle),poster)" -> not worked
"String.IsEqual(skin.string(poster_toggle),Poster)" -> worked
"String.IsEqual(skin.string(poster_toggle),postercase)" -> not worked
"String.IsEqual(skin.string(poster_toggle),Postercase)" -> worked
"String.IsEqual(skin.string(poster_toggle),keyart)" -> not worked
"String.IsEqual(skin.string(poster_toggle),Keyart)" -> worked

Not only uppercase/lowercase was not accepted but for example "MainPoster" or "ArtPoster" neither, very funny. Now it works. Poster Artwork Type toggling now repaired.
Tomorrow I will try to get characterarts to toggle. I'm curious how many spellings I have to try this time.

I'm sorry I've been sitting for hundreds of hours .xml but my learning curve is very weak, most is paste/copy & trial/error.
_____
My next little project is to try to convert a button in the DialogVideoInfo.xml that he can toggle between 3 states and the toggle button will be also renamed on toggle. It works very well between 2 states, but at 3 I have still no success. I'll try again and again next few days, but maybe I'll ask you in a few days if I'm not successful.

Thank You, You saved my day!
Toggling Code also working for Multi-Characterart Mod very well:

Code:
    <variable name="PLCharacterIconLabel">
        <value condition="String.IsEqual(Skin.String(character_icon),Character)">Characterart</value>
        <value condition="String.IsEqual(Skin.String(character_icon),Multicharacter)">Multi Characterart</value>
        <value condition="String.IsEqual(Skin.string(character_icon),Nocharacter)">No Characterart</value>
    </variable>

Code:
                <control type="button" id="921301">
                    <label>+ CHARACTERART</label>
                    <label2>$VAR[PLCharacterIconLabel]</label2>
                    <include>TopMenuButton</include>  
                    <onclick condition="String.IsEqual(skin.string(character_icon),Character)">Skin.SetString(character_icon,Multicharacter)</onclick>
                    <onclick condition="String.IsEqual(skin.string(character_icon),Multicharacter)">Skin.SetString(character_icon,Nocharacter)</onclick>
                    <onclick condition="String.IsEqual(skin.string(character_icon),Nocharacter)|String.IsEmpty(skin.string(character_icon))">Skin.SetString(character_icon,Character)</onclick>
                    <visible>Control.IsVisible(69) + Container.Content(tvshows)</visible>
                </control>


I have now learned to handle properly.

Now I try the same with a button in the DialogVideoInfo.xml to implement.
___
​​​​​​​EDIT: solved