Improvement in listcontrol for textOffsetY2 (1 Viewer)

pilehave

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

    At the moment a MediaPortal listcontrol will make the text in the listcontrol as wide as the listcontrol, if the textYOff/textYOff2/textYOff3 is not the same.

    This is to make multi-line lists available, and it works fine that way.

    Where it doesn't work fine, is when you want different textYOff/textYOff2/textYOff3 values, if you for example are using different fonts (with different height).

    Here, you don't want multiline, but if you try to adjust the textYOff/textYOff2/textYOff3 values, the texts will overlap (a long line in text1 will scroll over text2).

    The "offending" code is in "GUIListControl.cs" around and after line 556. Here an comparison is made:

    Code:
    if ((_text2Visible && pItem.Label2.Length > 0) && (_textOffsetY == _textOffsetY2))

    As stated before, this is fine if your purpose in setting different values is to make the listelement divided in one or more lines, but is a problem if you're trying to adjust for different font-heights.

    My suggestion is to:

    - Introduce a new XML-property into listcontrol (and this will probably affect a few others like playlistcontrol, up/down control etc.) called something like "multiLine". Setting this to "yes" will make the script work as before (allowing multilines) and setting it to "no" will free your inner skinner and allow for free positioning in the listelement.

    I have allready compiled my own version of a similar fix and hardcoded this in the script:

    Code:
          int diffOffsetY2 = Math.Abs(_textOffsetY - _textOffsetY2);
          if (((_text2Visible && pItem.Label2.Length > 0) && (_textOffsetY == _textOffsetY2)) || (diffOffsetY2 < 5))

    This approach is a bit different, but allows for a 4 pixel adjustment of the Y-offset of the second element (up or down).

    One would probably not adjust 4 pixel up/down if the text is meant to be on different lines, but this is just my interpretation of the reality ;)

    Hope to get some input!
     

    Users who are viewing this thread

    Top Bottom