Three-state button?

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
Leeuw Offline
Senior Member
Posts: 274
Joined: Apr 2009
Reputation: 0
Post: #1
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:
find quote
jmarshall Offline
Team-XBMC Developer
Posts: 24,523
Joined: Oct 2003
Reputation: 138
Post: #2
Put them in a group and make sure the <onleft><onright> point outside the group to the next items?

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: badge.gif]
find quote
Leeuw Offline
Senior Member
Posts: 274
Joined: Apr 2009
Reputation: 0
Post: #3
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)...
find quote
jmarshall Offline
Team-XBMC Developer
Posts: 24,523
Joined: Oct 2003
Reputation: 138
Post: #4
You just point the focus to the next group.

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: badge.gif]
find quote
Leeuw Offline
Senior Member
Posts: 274
Joined: Apr 2009
Reputation: 0
Post: #5
Duh, ok I clearly was out-thinking myself! I'll give this a try, thanks jm!
find quote