Kodi Community Forum

Full Version: Align to right of
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How do align an object to the right of another object?

I'm trying to say "episode number episode title" (e.g. EPISODE 7 CHUCK VERSUS THE FAT LADY) but in different font sizes, so would need to use separate labels, how do I align it so that when it reaches episode 10 the gap between the labels stays the same?

I know I've read it somewhere a while ago but can't remember, think it may have something to do with grouplists?

Thanks in advance.
yup, put the two labels in a horizontal grouplist
and use auto-width for both labels.

Code:
<width min="10" max="200">auto</width>
Or use <align>right</align> for the episode label and <align>left</align> for the title label.
Thanks for the replies but I don't understand how grouplists work...

At the moment my code looks like this

Quote:<control type="grouplist">
<posx>215</posx>
<posy>15</posy>
<width>700</width>
<height>60</height>
<itemgap>10</itemgap>
<orientation>horizontal</orientation>
<visible>true</visible>

<control type="label"> <!--episode number-->
<posx>0</posx>
<posy>11</posy>
<width min="10" max="200">auto</width>
<height>60</height>
<align>left</align>
<aligny>bottom</aligny>
<label>[UPPERCASE]Episode $INFO[ListItem.Episode][/UPPERCASE]</label>
<font>osd time</font>
<textcolor>infogrey</textcolor>
<visible>!IsEmpty(ListItem.Title)</visible>
</control>

<control type="label"> <!--episode title-->
<posy>15</posy>
<width min="10" max="200">auto</width>
<height>60</height>
<align>left</align>
<aligny>bottom</aligny>
<label>[UPPERCASE]$INFO[ListItem.Title][/UPPERCASE]</label>
<font>osd title</font>
<textcolor>infogrey</textcolor>
<visible>!IsEmpty(ListItem.Title)</visible>
</control>

</control>

However that doesn't display anything and the wiki page for grouplists really doesn't help much...
Grouplists don't work in a container if you're trying to do that... you have to use <align>right</align> to achive what you want to have.
That depends on what you mean by a container...

Unless I'm reading the wiki page wrong...

Quote:Auto Size Labels

Wrapping your label in a grouplist with the auto width and appropriate minium and maximum values. Allows the labels width to dynamically change relevalant to how long the label text is. This allows a image or other control to be alligned to the right of the actual label text no matter how wide the label is.

...it should be doable, I just don't really understand how grouplists work.

I would do it the way you're suggesting but then there will still be difference between 'EPISODE 9' and 'EPISODE 10' - just at the start rather than the end.
With inside a container I mean inside itemlayout or focusedlayout of a list or panel control. You have to use it outside of a container. And you'll always have a difference between 9 and 10, just because 10 is wider than 9... either at start or at the end depending on which align you use.
Ah right, thanks for the reply, it's a shame they can't be used in a container but I'll make do, got another grouplist working as well so it's all good!