ON/OFF Label for Radio Button
#1
I've created a new radio button on my PVR sideblade to switch the EPG genre colours On/Off using the following:-

<control type="radiobutton" id="6062">
     <include>MediaMenuItemsCommon</include>
     <label>Genre Colours ON</label>
     <selected>!Skin.HasSetting(disable_PVRGenres)</selected>
     <onclick>Skin.ToggleSetting(disable_PVRGenres)</onclick>
     <visible>Window.IsActive(MyPVRGuide.xml)</visible>
</control>

The button itself works fine, but I'm trying to figure out what I need to do in order that when the genre colours are switched off, the label next to button then reads 'Genre Colours OFF'. I'm sure I've created a similar button showing both labels in the past , but rather annoyingly I just can't remember what I did.
Any guidance/feedback would much appreciated.
Cheers
Reply
#2
If you use a togglebutton instead you can then just use an altlabel control. Or you can use a variable for the label and String.Contains(Control.GetLabel(6062),*) for the ON condition.
Reply
#3
you would need to make a 2nd epg image in Includes_PVR.xml
<control type="image" id="2">
                        <width>58</width>
                        <height>58</height>
                        <texture border="3" fallback="windows/pvr/epg-genres/0.png">$INFO[ListItem.Property(GenreType),windows/pvr/epg-genres/,.png]</texture>
<visible>Skin.HasSetting(disable_PVRGenres)</visible>
 </control>
<control type="image" id="2">
                        <width>58</width>
                        <height>58</height>
                        <texture border="3" fallback="windows/pvr/epg-genres/0.png">$INFO[ListItem.Property(GenreType),windows/pvr/epg-genres/,.png]</texture>
<visible>!Skin.HasSetting(disable_PVRGenres)</visible>
 </control>

! is the on off switch
Reply
#4
Thanks guys,
In the first instance I tried using togglebutton and altlabel, which worked in changing the label. The only problem was the button itself next to the label disappeared  Huh
I then tried using String.Contains(Control.GetLabel(6062),*) which I saw being used just the other day for the deleted recordings label, so thought this would be a breeze to do. Unfortunately, there must have been something wrong with my variable, because I just couldn't get it to work and gave up last night... Sad
But undeterred, I had a another look at this morning and came up with this solution, which seems to do exactly what I wanted to achieve:-
<variable name="PVR_Genre_Colours_Label_Var">
  <value condition="!Skin.HasSetting(disable_PVRGenres)">Genre Colours ON</value>
  <value condition="Skin.HasSetting(disable_PVRGenres)">Genre Colours OFF</value>
 </variable>

<control type="radiobutton" id="6062">
     <include>MediaMenuItemsCommon</include>
     <label>$VAR[PVR_Genre_Colours_Label_Var]</label>
     <selected>!Skin.HasSetting(disable_PVRGenres)</selected>
     <onclick>Skin.ToggleSetting(disable_PVRGenres)</onclick>
     <visible>Window.IsActive(MyPVRGuide.xml)</visible>
    </control>

So everything is working like a charm now. Smile  Amazing what a few hours sleep and a fresh pair of eyes looking at the same problem in the morning does!  Smile
Thanks again for your help.
Cheers
Reply
 
Thread Rating:
  • 0 Vote(s) - 0 Average



Logout Mark Read Team Forum Stats Members Help
ON/OFF Label for Radio Button00