[fixed] - new feature for StackLayout not quite done...

Discussion in 'MediaPortal 1.2.0 ALPHA' started by pilehave, December 22, 2010.

  1. pilehave
    • Premium Supporter

    pilehave Community Skin Designer

    Joined:
    April 2, 2008
    Messages:
    2,566
    Likes Received:
    500
    Gender:
    Male
    Occupation:
    Technical consultant, marketing
    Location:
    Hornslet
    Ratings:
    +517 / 0
    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 (Text):
    1.  
    2.         <control>
    3.           <description>group element</description>
    4.           <type>group</type>
    5.           <posX>71</posX>
    6.           <posY>121</posY>
    7.           <layout>StackLayout(5, Vertical, true)</layout>
    8.           <animation effect="slide" time="250" start="-300,0" reversible="false">visible</animation>
    9.           <animation effect="slide" time="250" end="-300,0" reversible="false">hidden</animation>
    10.           <visible>!Control.HasFocus(50)</visible>
    11.          
    12.           <control>
    13.             <description>View-As button</description>
    14.             <type>button</type>
    15.             <id>2</id>
    16.             <label>100</label>
    17.             <onright>50</onright>
    18.             <onup>17</onup>
    19.             <ondown>20</ondown>
    20.           </control>
    21.          
    22.           <control>
    23.             <description>Shuffle button</description>
    24.             <type>button</type>
    25.             <id>20</id>
    26.             <label>191</label>
    27.             <onright>50</onright>
    28.             <onup>2</onup>
    29.             <ondown>30</ondown>
    30.           </control>
    31.          
    32.           <control>
    33.             <description>Repeat on/off button</description>
    34.             <type>togglebutton</type>
    35.             <id>30</id>
    36.             <label>486</label>
    37.             <onright>50</onright>
    38.             <onup>20</onup>
    39.             <ondown>10</ondown>
    40.           </control>
    41.          
    42.           <control>
    43.             <description>My Playlists</description>
    44.             <type>button</type>
    45.             <id>10</id>
    46.             <label>983</label>
    47.             <onright>50</onright>
    48.             <onup>30</onup>
    49.             <ondown>21</ondown>
    50.           </control>
    51.          
    52.           <control>
    53.             <description>Save button</description>
    54.             <type>button</type>
    55.             <id>21</id>
    56.             <label>190</label>
    57.             <onright>50</onright>
    58.             <onup>10</onup>
    59.             <ondown>22</ondown>
    60.           </control>
    61.          
    62.           <control>
    63.             <description>Clear button</description>
    64.             <type>button</type>
    65.             <id>22</id>
    66.             <label>192</label>
    67.             <onright>50</onright>
    68.             <onup>21</onup>
    69.             <ondown>26</ondown>
    70.           </control>
    71.  
    72.           <control>
    73.             <description>Now playing</description>
    74.             <type>button</type>
    75.             <id>26</id>
    76.             <label>4540</label>
    77.             <hyperlink>510</hyperlink>
    78.             <onright>50</onright>
    79.             <onup>22</onup>
    80.             <ondown>28</ondown>
    81.         <visible>Player.HasAudio</visible>
    82.           </control>
    83.          
    84.           <control>
    85.             <description>scrobble mode button</description>
    86.             <type>button</type>
    87.             <id>28</id>
    88.             <label>33001</label>
    89.             <onright>50</onright>
    90.             <onup>26</onup>
    91.             <ondown>27</ondown>
    92.             <visible>plugin.isenabled(Audioscrobbler)</visible>
    93.           </control>
    94.          
    95.           <control>
    96.             <description>scrobble on/off button</description>
    97.             <type>togglebutton</type>
    98.             <id>27</id>
    99.             <label>33000</label>
    100.             <onright>50</onright>
    101.             <onup>28</onup>
    102.             <ondown>29</ondown>
    103.             <visible>plugin.isenabled(Audioscrobbler)</visible>
    104.           </control>
    105.          
    106.           <control>
    107.             <description>scrobble user button</description>
    108.             <type>button</type>
    109.             <id>29</id>
    110.             <label>Scrobbler: </label>
    111.             <onright>50</onright>
    112.             <onup>27</onup>
    113.             <ondown>99</ondown>
    114.             <visible>plugin.isenabled(Audioscrobbler)</visible>
    115.           </control>
    116.          
    117.         </control>
    118.  
    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 :)
     
    • Like Like x 1
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. SilentException
    • Premium Supporter

    SilentException Retired Team Member

    Joined:
    October 27, 2008
    Messages:
    2,617
    Likes Received:
    1,125
    Gender:
    Male
    Location:
    Rijeka, Croatia
    Ratings:
    +1,129 / 0
    Home Country:
    Croatia Croatia
    Hm I tested this behavior (conditional visibility of buttons) and it worked fine. Possible problem is in the actiongroup / stacklayout definition.
     
    • Like Like x 1
  4. pilehave
    • Premium Supporter

    pilehave Community Skin Designer

    Joined:
    April 2, 2008
    Messages:
    2,566
    Likes Received:
    500
    Gender:
    Male
    Occupation:
    Technical consultant, marketing
    Location:
    Hornslet
    Ratings:
    +517 / 0
    Home Country:
    Denmark Denmark
    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.
     
  5. SilentException
    • Premium Supporter

    SilentException Retired Team Member

    Joined:
    October 27, 2008
    Messages:
    2,617
    Likes Received:
    1,125
    Gender:
    Male
    Location:
    Rijeka, Croatia
    Ratings:
    +1,129 / 0
    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.
     

    Attached Files:

  6. pilehave
    • Premium Supporter

    pilehave Community Skin Designer

    Joined:
    April 2, 2008
    Messages:
    2,566
    Likes Received:
    500
    Gender:
    Male
    Occupation:
    Technical consultant, marketing
    Location:
    Hornslet
    Ratings:
    +517 / 0
    Home Country:
    Denmark Denmark
    Could you post some of the code?

    :D
     
  7. SilentException
    • Premium Supporter

    SilentException Retired Team Member

    Joined:
    October 27, 2008
    Messages:
    2,617
    Likes Received:
    1,125
    Gender:
    Male
    Location:
    Rijeka, Croatia
    Ratings:
    +1,129 / 0
    Home Country:
    Croatia Croatia
  8. pilehave
    • Premium Supporter

    pilehave Community Skin Designer

    Joined:
    April 2, 2008
    Messages:
    2,566
    Likes Received:
    500
    Gender:
    Male
    Occupation:
    Technical consultant, marketing
    Location:
    Hornslet
    Ratings:
    +517 / 0
    Home Country:
    Denmark Denmark
    With your code, I can still reproduce the extra 5px space when I use

    Code (Text):
    1.  
    2. <layout>StackLayout(5, Vertical, true)</layout>
    3.  
    And when I add my own controls with visibility conditions:

    Code (Text):
    1.  
    2. <control>
    3.     <description>group element</description>
    4.     <type>group</type>
    5.     <posX>71</posX>
    6.     <posY>121</posY>
    7.     <layout>StackLayout(5, Vertical, true)</layout>
    8.    
    9.     <control>
    10.         <description>View-As</description>
    11.         <type>button</type>
    12.         <id>2</id>
    13.         <label>100</label>
    14.         <onright>50</onright>
    15.         <onup>17</onup>
    16.         <ondown>3</ondown>
    17.     </control>
    18.    
    19.     <control>
    20.         <description>Sort</description>
    21.         <type>sortbutton</type>
    22.         <id>3</id>
    23.         <label>103</label>
    24.         <onright>50</onright>
    25.         <onup>2</onup>
    26.         <ondown>5</ondown>
    27.     </control>
    28.    
    29.     <control>
    30.         <description>Switch View</description>
    31.         <type>button</type>
    32.         <id>5</id>
    33.         <label>457</label>
    34.         <onright>50</onright>
    35.         <onup>3</onup>
    36.         <ondown>6</ondown>
    37.     </control>
    38.    
    39.     <control>
    40.         <description>Play DVD</description>
    41.         <type>button</type>
    42.         <id>6</id>
    43.         <label>341</label>
    44.         <onright>50</onright>
    45.         <onup>5</onup>
    46.         <ondown>20</ondown>
    47.     </control>
    48.    
    49.     <control>
    50.         <description>Current Playlist</description>
    51.         <type>button</type>
    52.         <id>20</id>
    53.         <label>4555</label>
    54.         <action>33</action>
    55.         <onright>50</onright>
    56.         <onup>6</onup>
    57.         <ondown>9</ondown>
    58.         <visible>player.paused</visible>
    59.     </control>
    60.    
    61.     <control>
    62.         <description>My Playlists</description>
    63.         <type>button</type>
    64.         <id>9</id>
    65.         <label>983</label>
    66.         <onright>50</onright>
    67.         <onup>20</onup>
    68.         <ondown>9111</ondown>
    69.     </control>
    70.    
    71.     <control>
    72.         <description>scrobble mode button</description>
    73.         <type>button</type>
    74.         <id>28</id>
    75.         <label>33001</label>
    76.         <onright>50</onright>
    77.         <onup>26</onup>
    78.         <ondown>27</ondown>
    79.         <visible>plugin.isenabled(Audioscrobbler)</visible>
    80.     </control>
    81.    
    82.     <control>
    83.         <description>scrobble on/off button</description>
    84.         <type>togglebutton</type>
    85.         <id>27</id>
    86.         <label>33000</label>
    87.         <onright>50</onright>
    88.         <onup>28</onup>
    89.         <ondown>29</ondown>
    90.         <visible>plugin.isenabled(Audioscrobbler)</visible>
    91.     </control>
    92.    
    93.     <control>
    94.         <description>scrobble user button</description>
    95.         <type>button</type>
    96.         <id>29</id>
    97.         <label>Scrobbler: </label>
    98.         <onright>50</onright>
    99.         <onup>27</onup>
    100.         <ondown>99</ondown>
    101.         <visible>plugin.isenabled(Audioscrobbler)</visible>
    102.     </control>
    103.  
    104. </control>
    105.  
    it bugs out again. I think one of the problems is, that one of my extra buttons is a "togglebutton":

    Code (Text):
    1.  
    2. <control>
    3.     <description>group element</description>
    4.     <type>group</type>
    5.     <posX>71</posX>
    6.     <posY>121</posY>
    7.     <layout>StackLayout(5, Vertical, true)</layout>
    8.    
    9.     <control>
    10.         <description>View-As</description>
    11.         <type>button</type>
    12.         <id>2</id>
    13.         <label>100</label>
    14.         <onright>50</onright>
    15.         <onup>17</onup>
    16.         <ondown>3</ondown>
    17.     </control>
    18.    
    19.     <control>
    20.         <description>Sort</description>
    21.         <type>sortbutton</type>
    22.         <id>3</id>
    23.         <label>103</label>
    24.         <onright>50</onright>
    25.         <onup>2</onup>
    26.         <ondown>5</ondown>
    27.     </control>
    28.    
    29.     <control>
    30.         <description>Switch View</description>
    31.         <type>button</type>
    32.         <id>5</id>
    33.         <label>457</label>
    34.         <onright>50</onright>
    35.         <onup>3</onup>
    36.         <ondown>6</ondown>
    37.     </control>
    38.    
    39.     <control>
    40.         <description>Play DVD</description>
    41.         <type>button</type>
    42.         <id>6</id>
    43.         <label>341</label>
    44.         <onright>50</onright>
    45.         <onup>5</onup>
    46.         <ondown>20</ondown>
    47.     </control>
    48.    
    49.     <control>
    50.         <description>Current Playlist</description>
    51.         <type>button</type>
    52.         <id>20</id>
    53.         <label>4555</label>
    54.         <action>33</action>
    55.         <onright>50</onright>
    56.         <onup>6</onup>
    57.         <ondown>9</ondown>
    58.         <visible>player.paused</visible>
    59.     </control>
    60.    
    61.     <control>
    62.         <description>My Playlists</description>
    63.         <type>button</type>
    64.         <id>9</id>
    65.         <label>983</label>
    66.         <onright>50</onright>
    67.         <onup>20</onup>
    68.         <ondown>9111</ondown>
    69.     </control>
    70.    
    71.     <control>
    72.         <description>scrobble mode button</description>
    73.         <type>button</type>
    74.         <id>28</id>
    75.         <label>33001</label>
    76.         <onright>50</onright>
    77.         <onup>26</onup>
    78.         <ondown>27</ondown>
    79.         <visible>plugin.isenabled(Audioscrobbler)</visible>
    80.     </control>
    81.    
    82.     <control>
    83.         <description>scrobble on/off button</description>
    84.         <type>togglebutton</type>
    85.         <id>27</id>
    86.         <label>33000</label>
    87.         <onright>50</onright>
    88.         <onup>28</onup>
    89.         <ondown>29</ondown>
    90.         <visible>plugin.isenabled(Audioscrobbler)</visible>
    91.     </control>
    92.    
    93.     <control>
    94.         <description>scrobble user button</description>
    95.         <type>button</type>
    96.         <id>29</id>
    97.         <label>Scrobbler: </label>
    98.         <onright>50</onright>
    99.         <onup>27</onup>
    100.         <ondown>99</ondown>
    101.         <visible>plugin.isenabled(Audioscrobbler)</visible>
    102.     </control>
    103.  
    104. </control>
    105.  
     
    • Like Like x 1
  9. pilehave
    • Premium Supporter

    pilehave Community Skin Designer

    Joined:
    April 2, 2008
    Messages:
    2,566
    Likes Received:
    500
    Gender:
    Male
    Occupation:
    Technical consultant, marketing
    Location:
    Hornslet
    Ratings:
    +517 / 0
    Home Country:
    Denmark Denmark
    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...
     
  10. SilentException
    • Premium Supporter

    SilentException Retired Team Member

    Joined:
    October 27, 2008
    Messages:
    2,617
    Likes Received:
    1,125
    Gender:
    Male
    Location:
    Rijeka, Croatia
    Ratings:
    +1,129 / 0
    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 :)
     
    • Like Like x 1
  11. pilehave
    • Premium Supporter

    pilehave Community Skin Designer

    Joined:
    April 2, 2008
    Messages:
    2,566
    Likes Received:
    500
    Gender:
    Male
    Occupation:
    Technical consultant, marketing
    Location:
    Hornslet
    Ratings:
    +517 / 0
    Home Country:
    Denmark Denmark
    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 (Text):
    1.  
    2. Index: GUIGroup.cs
    3. ===================================================================
    4. --- GUIGroup.cs (revision 27093)
    5. +++ GUIGroup.cs (working copy)
    6. @@ -328,13 +328,13 @@
    7.        }
    8.        cntl.DimColor = DimColor;
    9.        Children.Add(cntl);
    10. -      if (cntl is GUIButtonControl)
    11. +      if (cntl is GUIControl)
    12.        {
    13.          if (_buttons == null)
    14.          {
    15. -          _buttons = new List<GUIButtonControl>();
    16. +          _buttons = new List<GUIControl>();
    17.          }
    18. -        _buttons.Add((GUIButtonControl)cntl);
    19. +        _buttons.Add((GUIControl)cntl);
    20.        }
    21.      }
    22.  
    23. @@ -443,7 +443,7 @@
    24.      private Animator _animator;
    25.      private int _beginInitCount = 0;
    26.      private GUIControlCollection _children;
    27. -    private List<GUIButtonControl> _buttons = null;
    28. +    private List<GUIControl> _buttons = null;
    29.      private Point[] _positions = null;
    30.      private Point[] _modPositions = null;
    31.      private bool _first = true;
    32.  
    (and the naming convention has gone off the chart, when I start calling controls for buttons, so the patch needs some work).
     
Loading...

Users Viewing Thread (Users: 0, Guests: 0)

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice
  • About The Project

    The vision of the MediaPortal project is to create a free open source media centre application, which supports all advanced media centre functions, and is accessible to all Windows users.

    In reaching this goal we are working every day to make sure our software is one of the best.

             

  • Support MediaPortal!

    The team works very hard to make sure the community is running the best HTPC-software. We give away MediaPortal for free but hosting and software is not for us.

    Care to support our work with a few bucks? We'd really appreciate it!