Kodi Community Forum

Full Version: Three-state button?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am trying to do a little hackery to get the effect of a toggle button with 3 states, per the below:

Code:
    <include name="Objects_MultiplexOpacityButtons">
        <control type="button" id="9988">
            <include>Objects_MediaMenuButton</include>  
            <label>$LOCALIZE[31065]: $LOCALIZE[31052]</label>
            <onclick>Skin.SetBool(multiplexopacitythin)</onclick>
            <onclick>Skin.Reset(multiplexopacitythick)</onclick>
            <onclick>Skin.SetString(multiplexopacitylevel,thin)</onclick>
            <onclick>SetFocus(9989)</onclick>
            <visible allowhiddenfocus="true">Window.IsActive(25) + Control.IsVisible(52) + ![Skin.HasSetting(multiplexopacitythin) | Skin.HasSetting(multiplexopacityfine)]</visible>
        </control>
  
        <control type="button" id="9989">
            <include>Objects_MediaMenuButton</include>  
            <label>$LOCALIZE[31065]: $LOCALIZE[31053]</label>
            <onclick>Skin.SetBool(multiplexopacityfine)</onclick>
            <onclick>Skin.Reset(multiplexopacitythin)</onclick>
            <onclick>Skin.SetString(multiplexopacitylevel,fine)</onclick>
            <onclick>SetFocus(9990)</onclick>
            <visible allowhiddenfocus="true">Window.IsActive(25) + Control.IsVisible(52) + Skin.HasSetting(multiplexopacitythin)</visible>
        </control>

        <control type="button" id="9990">
            <include>Objects_MediaMenuButton</include>    
            <label>$LOCALIZE[31065]: $LOCALIZE[386]</label>
            <onclick>Skin.SetBool(multiplexopacitythick)</onclick>
            <onclick>Skin.Reset(multiplexopacityfine)</onclick>
            <onclick>Skin.SetString(multiplexopacitylevel,thick)</onclick>
            <onclick>SetFocus(9988)</onclick>
            <visible allowhiddenfocus="true">Window.IsActive(25) + Control.IsVisible(52) + Skin.HasSetting(multiplexopacityfine)</visible>
        </control>
    </include>


This actually works pretty well, except that the 3-state button is part of a larger grouplist of buttons (the Aeon menu bar if you hadn't guessed Smile), and turning on allowhiddenfocus causes the "hidden" buttons to get focus when you are scrolling left and right through the list. It still works, but you have to press left/right 2-3 times in order to move onto or off of the 3-state button. Anyone know a way to fix this? :confused2:
Put them in a group and make sure the <onleft><onright> point outside the group to the next items?
jmarshall Wrote:Put them in a group and make sure the <onleft><onright> point outside the group to the next items?

Ah, except I forgot to mention that the neighbouring buttons in the group (which are part of the default Auriga) also use the same bit of hackery to create the impression of a three-state button. So would you need conditional includes as to which states those are in for <onright> and <onleft> (at which point this is probably getting too complicated)...
You just point the focus to the next group.
Duh, ok I clearly was out-thinking myself! I'll give this a try, thanks jm!