[fixed] new feature for StackLayout not quite done... (2 Viewers)

pilehave

Community Skin Designer
  • Premium Supporter
  • April 2, 2008
    2,566
    521
    Hornslet
    Home Country
    Denmark Denmark
    Hi

    If you use the new feature in StackLayout for a group:
    0003241: Auto placing of controls in grouped StackLayout - MediaPortal Bugtracker

    as documented in the Wiki:
    StackLayout shift buttons - MediaPortal Wiki

    You will have an issue if one or more of your buttons has a conditional visibility, like this, where the "Now Playing" button only shows, when media is actually playing (which makes sense to me):

    Code:
            <control>
              <description>group element</description>
              <type>group</type>
              <posX>71</posX>
              <posY>121</posY>
              <layout>StackLayout(5, Vertical, true)</layout>
              <animation effect="slide" time="250" start="-300,0" reversible="false">visible</animation>
              <animation effect="slide" time="250" end="-300,0" reversible="false">hidden</animation>
              <visible>!Control.HasFocus(50)</visible>
    		  
              <control>
                <description>View-As button</description>
                <type>button</type>
                <id>2</id>
                <label>100</label>
                <onright>50</onright>
                <onup>17</onup>
                <ondown>20</ondown>
              </control>
    		  
              <control>
                <description>Shuffle button</description>
                <type>button</type>
                <id>20</id>
                <label>191</label>
                <onright>50</onright>
                <onup>2</onup>
                <ondown>30</ondown>
              </control>
    		  
              <control>
                <description>Repeat on/off button</description>
                <type>togglebutton</type>
                <id>30</id>
                <label>486</label>
                <onright>50</onright>
                <onup>20</onup>
                <ondown>10</ondown>
              </control>
    		  
              <control>
                <description>My Playlists</description>
                <type>button</type>
                <id>10</id>
                <label>983</label>
                <onright>50</onright>
                <onup>30</onup>
                <ondown>21</ondown>
              </control>
    		  
              <control>
                <description>Save button</description>
                <type>button</type>
                <id>21</id>
                <label>190</label>
                <onright>50</onright>
                <onup>10</onup>
                <ondown>22</ondown>
              </control>
    		  
              <control>
                <description>Clear button</description>
                <type>button</type>
                <id>22</id>
                <label>192</label>
                <onright>50</onright>
                <onup>21</onup>
                <ondown>26</ondown>
              </control>
    
              <control>
                <description>Now playing</description>
                <type>button</type>
                <id>26</id>
                <label>4540</label>
                <hyperlink>510</hyperlink>
                <onright>50</onright>
                <onup>22</onup>
                <ondown>28</ondown>
    	    <visible>Player.HasAudio</visible>
              </control>
    		  
              <control>
                <description>scrobble mode button</description>
                <type>button</type>
                <id>28</id>
                <label>33001</label>
                <onright>50</onright>
                <onup>26</onup>
                <ondown>27</ondown>
                <visible>plugin.isenabled(Audioscrobbler)</visible>
              </control>
    		  
              <control>
                <description>scrobble on/off button</description>
                <type>togglebutton</type>
                <id>27</id>
                <label>33000</label>
                <onright>50</onright>
                <onup>28</onup>
                <ondown>29</ondown>
                <visible>plugin.isenabled(Audioscrobbler)</visible>
              </control>
    		  
              <control>
                <description>scrobble user button</description>
                <type>button</type>
                <id>29</id>
                <label>Scrobbler: </label>
                <onright>50</onright>
                <onup>27</onup>
                <ondown>99</ondown>
                <visible>plugin.isenabled(Audioscrobbler)</visible>
              </control>
    		  
            </control>

    It actually has two issues:
    - an extra 5px blank space is put in where the button was, so you have 10px space between two of the buttons
    - the position of the buttons below the hidden one, are misplaced:

    playlist.png

    I see two ways of dealing with this; either disallow conditional visibility on buttons in a group (not my idea) or patch up to deal with buttons that can have conditional visibility.

    I'll try the last option at some time in the holiday :)
     

    pilehave

    Community Skin Designer
  • Premium Supporter
  • April 2, 2008
    2,566
    521
    Hornslet
    Home Country
    Denmark Denmark
    • Thread starter
    • Moderator
    • #3
    Hm I tested this behavior (conditional visibility of buttons) and it worked fine. Possible problem is in the actiongroup / stacklayout definition.

    The codesnippet I pasted can be used in Blue3Wide to show the issue. From my quick log-test, it seems the conditional value are only checked after the StackLayout has been build...

    Moving the group out of the actiongroup doesn't seem to fix anything for me.
     

    SilentException

    Retired Team Member
  • Premium Supporter
  • October 27, 2008
    2,617
    1,130
    Rijeka, Croatia
    Home Country
    Croatia Croatia
    Wait few minutes, I'll upload video where this is working. Condition is player.paused and I'm pausing and unpausing. Skin is Black Glass Nova tho, that's why I doubted the definition of controls might be off..

    Edit: Video uploaded, made with Fraps so you might need VLC to play it.. Or MPC with ffdshow.
     

    Attachments

    • MediaPortal 2010-12-22 11-45-25-72.rar
      246 KB

    pilehave

    Community Skin Designer
  • Premium Supporter
  • April 2, 2008
    2,566
    521
    Hornslet
    Home Country
    Denmark Denmark
    • Thread starter
    • Moderator
    • #5
    Wait few minutes, I'll upload video where this is working. Condition is player.paused and I'm pausing and unpausing. Skin is Black Glass Nova tho, that's why I doubted the definition of controls might be off..

    Edit: Video uploaded, made with Fraps so you might need VLC to play it.. Or MPC with ffdshow.

    Could you post some of the code?

    :D
     

    pilehave

    Community Skin Designer
  • Premium Supporter
  • April 2, 2008
    2,566
    521
    Hornslet
    Home Country
    Denmark Denmark
    • Thread starter
    • Moderator
    • #7
    myvideoHiddenMenu.xml - blackglass - Project Hosting on Google Code

    I added the code for new style: <layout>StackLayout(0, Vertical, true)</layout>

    And the visible condition to one of the buttons: <visible>player.paused</visible>

    With your code, I can still reproduce the extra 5px space when I use

    Code:
    <layout>StackLayout(5, Vertical, true)</layout>

    And when I add my own controls with visibility conditions:

    Code:
    <control>
    	<description>group element</description>
    	<type>group</type>
    	<posX>71</posX>
    	<posY>121</posY>
    	<layout>StackLayout(5, Vertical, true)</layout>
    	
    	<control>
    		<description>View-As</description>
    		<type>button</type>
    		<id>2</id>
    		<label>100</label>
    		<onright>50</onright>
    		<onup>17</onup>
    		<ondown>3</ondown>
    	</control>
    	
    	<control>
    		<description>Sort</description>
    		<type>sortbutton</type>
    		<id>3</id>
    		<label>103</label>
    		<onright>50</onright>
    		<onup>2</onup>
    		<ondown>5</ondown>
    	</control>
    	
    	<control>
    		<description>Switch View</description>
    		<type>button</type>
    		<id>5</id>
    		<label>457</label>
    		<onright>50</onright>
    		<onup>3</onup>
    		<ondown>6</ondown>
    	</control>
    	
    	<control>
    		<description>Play DVD</description>
    		<type>button</type>
    		<id>6</id>
    		<label>341</label>
    		<onright>50</onright>
    		<onup>5</onup>
    		<ondown>20</ondown>
    	</control>
    	
    	<control>
    		<description>Current Playlist</description>
    		<type>button</type>
    		<id>20</id>
    		<label>4555</label>
    		<action>33</action>
    		<onright>50</onright>
    		<onup>6</onup>
    		<ondown>9</ondown>
    		<visible>player.paused</visible>
    	</control>
    	
    	<control>
    		<description>My Playlists</description>
    		<type>button</type>
    		<id>9</id>
    		<label>983</label>
    		<onright>50</onright>
    		<onup>20</onup>
    		<ondown>9111</ondown>
    	</control>
    	
    	<control>
    		<description>scrobble mode button</description>
    		<type>button</type>
    		<id>28</id>
    		<label>33001</label>
    		<onright>50</onright>
    		<onup>26</onup>
    		<ondown>27</ondown>
    		<visible>plugin.isenabled(Audioscrobbler)</visible>
    	</control>
    	
    	<control>
    		<description>scrobble on/off button</description>
    		<type>togglebutton</type>
    		<id>27</id>
    		<label>33000</label>
    		<onright>50</onright>
    		<onup>28</onup>
    		<ondown>29</ondown>
    		<visible>plugin.isenabled(Audioscrobbler)</visible>
    	</control>
    	
    	<control>
    		<description>scrobble user button</description>
    		<type>button</type>
    		<id>29</id>
    		<label>Scrobbler: </label>
    		<onright>50</onright>
    		<onup>27</onup>
    		<ondown>99</ondown>
    		<visible>plugin.isenabled(Audioscrobbler)</visible>
    	</control>
    
    </control>

    it bugs out again. I think one of the problems is, that one of my extra buttons is a "togglebutton":

    Code:
    <control>
    	<description>group element</description>
    	<type>group</type>
    	<posX>71</posX>
    	<posY>121</posY>
    	<layout>StackLayout(5, Vertical, true)</layout>
    	
    	<control>
    		<description>View-As</description>
    		<type>button</type>
    		<id>2</id>
    		<label>100</label>
    		<onright>50</onright>
    		<onup>17</onup>
    		<ondown>3</ondown>
    	</control>
    	
    	<control>
    		<description>Sort</description>
    		<type>sortbutton</type>
    		<id>3</id>
    		<label>103</label>
    		<onright>50</onright>
    		<onup>2</onup>
    		<ondown>5</ondown>
    	</control>
    	
    	<control>
    		<description>Switch View</description>
    		<type>button</type>
    		<id>5</id>
    		<label>457</label>
    		<onright>50</onright>
    		<onup>3</onup>
    		<ondown>6</ondown>
    	</control>
    	
    	<control>
    		<description>Play DVD</description>
    		<type>button</type>
    		<id>6</id>
    		<label>341</label>
    		<onright>50</onright>
    		<onup>5</onup>
    		<ondown>20</ondown>
    	</control>
    	
    	<control>
    		<description>Current Playlist</description>
    		<type>button</type>
    		<id>20</id>
    		<label>4555</label>
    		<action>33</action>
    		<onright>50</onright>
    		<onup>6</onup>
    		<ondown>9</ondown>
    		<visible>player.paused</visible>
    	</control>
    	
    	<control>
    		<description>My Playlists</description>
    		<type>button</type>
    		<id>9</id>
    		<label>983</label>
    		<onright>50</onright>
    		<onup>20</onup>
    		<ondown>9111</ondown>
    	</control>
    	
    	<control>
    		<description>scrobble mode button</description>
    		<type>button</type>
    		<id>28</id>
    		<label>33001</label>
    		<onright>50</onright>
    		<onup>26</onup>
    		<ondown>27</ondown>
    		<visible>plugin.isenabled(Audioscrobbler)</visible>
    	</control>
    	
    	<control>
    		<description>scrobble on/off button</description>
    		<type>togglebutton</type>
    		<id>27</id>
    		<label>33000</label>
    		<onright>50</onright>
    		<onup>28</onup>
    		<ondown>29</ondown>
    		<visible>plugin.isenabled(Audioscrobbler)</visible>
    	</control>
    	
    	<control>
    		<description>scrobble user button</description>
    		<type>button</type>
    		<id>29</id>
    		<label>Scrobbler: </label>
    		<onright>50</onright>
    		<onup>27</onup>
    		<ondown>99</ondown>
    		<visible>plugin.isenabled(Audioscrobbler)</visible>
    	</control>
    
    </control>
     

    pilehave

    Community Skin Designer
  • Premium Supporter
  • April 2, 2008
    2,566
    521
    Hornslet
    Home Country
    Denmark Denmark
    • Thread starter
    • Moderator
    • #8
    Yup, I see now that the togglebutton is not being shiftet upwards with the visibility change.

    In GUIGroup.cs the List "_buttons" (wich contains the buttons for the group) is cast as <GUIButtonControl> which is valid only for buttons...
     

    SilentException

    Retired Team Member
  • Premium Supporter
  • October 27, 2008
    2,617
    1,130
    Rijeka, Croatia
    Home Country
    Croatia Croatia
    I feared there still might be something wrong with the offset. Need to take closer look but cannot do it until tonight. Or if you can fix it, just provide a patch ;)

    About the toggle buttons, perhaps the list could be modified to contain the controls in general, not just buttons.. Same goes: if you have a patch, post it, otherwise wait a little :)
     

    pilehave

    Community Skin Designer
  • Premium Supporter
  • April 2, 2008
    2,566
    521
    Hornslet
    Home Country
    Denmark Denmark
    • Thread starter
    • Moderator
    • #10
    I think this might just cut it as a patch for general controls, but we need someone to confirm that this doesn't screw anything up:

    Code:
    Index: GUIGroup.cs
    ===================================================================
    --- GUIGroup.cs	(revision 27093)
    +++ GUIGroup.cs	(working copy)
    @@ -328,13 +328,13 @@
           }
           cntl.DimColor = DimColor;
           Children.Add(cntl);
    -      if (cntl is GUIButtonControl)
    +      if (cntl is GUIControl)
           {
             if (_buttons == null)
             {
    -          _buttons = new List<GUIButtonControl>();
    +          _buttons = new List<GUIControl>();
             }
    -        _buttons.Add((GUIButtonControl)cntl);
    +        _buttons.Add((GUIControl)cntl);
           }
         }
     
    @@ -443,7 +443,7 @@
         private Animator _animator;
         private int _beginInitCount = 0;
         private GUIControlCollection _children;
    -    private List<GUIButtonControl> _buttons = null;
    +    private List<GUIControl> _buttons = null;
         private Point[] _positions = null;
         private Point[] _modPositions = null;
         private bool _first = true;

    (and the naming convention has gone off the chart, when I start calling controls for buttons, so the patch needs some work).
     

    Users who are viewing this thread

    Top Bottom