Kodi Community Forum

Full Version: Button Control doesn't inherit size from Group Control?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have some code like this:

Code:
<control type="grouplist">
<left>100</left>
<top>570</top>
<width>375</width>
<height>40</height>
<orientation>horizontal</orientation>
<itemgap>0</itemgap>
    <control type="group">
        <width>28</width>
        <height>40</height>
        <control type="button">
              <description>Timestep 0</description>
              <onclick>SetProperty(Weather.SliderPosition, 0)</onclick>
              <onclick>RunScript(weather.metoffice, ForecastMap)</onclick>
        </control>
        <control type="image">
            <visible>StringCompare(Window.Property(Weather.SliderPosition), 0)</visible>
            <texture>ScrollBarH_bar_focus.png</texture>
        </control>
    </control>
        ...more groups...

I expected the button to inherit its width and height from the parent group, since that's what other controls seem to do. However this doesn't seem to be the case.

Is this a bug?
I presume you're running Gotham as you're using <left> and <top>.

Then it will inherit <width> and <height> from the parent if it's not already defined within the button itself. This might be in defaults.xml for example.
Yes, I'm using Gotham. Not tried Frodo yet. And yes, it seems like it's inheriting default button sizing. from defaults.xml. (width 300, height 42) I forgot those defaults were there.

Hmm. So there are two sources used for implicit values and there seems to be a clash. I don't know how the renderer figures out what values to use, but my instinct would be to only use the default when a value can't be determined. In this case a width and height can be determined from the parent group, so the default shouldn't be used.

Maybe there are instances where this logic doesn't work. Or maybe there are skins that rely on the default being used even though parent values are given.
Generally I wouldn't ever use defaults for sizing, as sizing is almost always going to change.

Defaults always take priority over inheritance from the parent (which applies only to sizing anyway, except in some specific circumstances such as grouplist which can push actions/navigation down to it's controls).