len or length function
#1
The idea is that a text label would be visible [or not] depending on the number of characters it contained.
Anyway of doing this with the current tools?
Reply
#2
(2012-08-16, 00:34)adrian ballard Wrote: The idea is that a text label would be visible [or not] depending on the number of characters it contained.
Anyway of doing this with the current tools?

no.
Donate: https://kodi.tv/contribute/donate (foundation), 146Gr48FqHM7TPB9q33HHv6uWpgQqdz1yk (BTC personal)
Estuary: Kodis new default skin - ExtendedInfo Script - KodiDevKit
Reply
#3
Can you tell more? What should the label display? Could be possible with a script.
Image
Reply
#4
I was hoping to achieve a 'fake' way to make fadelabel work within a group list.
Grouplist would contain [from left to right] watched indicator, title, HD badge. However, it would resize as needed.
Easy enough to create without the fadelabel for the title. Introduce the fadelabel and the title field always defaults to the max width.
If a length control was available, I could build it so that the title field used a regular label up to a given number of characters.
Exceed that number and a fadelabel would be visible instead.

And, just my .02, use of a fadelabel looks much better than just plain scrolling text.
ie:
PHP Code:
<control type="fadelabel" description="MAIN TITLE">
    <
width min="10" max="500">auto</width>
    <
height>35</height>
    <
scrollout>false</scrollout>
    <
pauseatend>600</pauseatend>
    <
scrollspeed>20</scrollspeed>
    <
font>size24</font>
    <
textcolor>TEXT_LIST_ITEM-SELECTED_COLOR</textcolor>
    <
shadowcolor>TEXT_SHADOW_COLOR</shadowcolor>
    <
label>[B]$INFO[ListItem.Label][/B]</label>
</
control
Reply
#5
a "Control.GetLength()" as built-in function would be too great, then we could use it combined with IntegerGreaterThan()
Donate: https://kodi.tv/contribute/donate (foundation), 146Gr48FqHM7TPB9q33HHv6uWpgQqdz1yk (BTC personal)
Estuary: Kodis new default skin - ExtendedInfo Script - KodiDevKit
Reply
#6
Exactly....
I know its a small request that probably wouldn't get used that often but if it's doable, it's still a worthwhile tool.

More tools = better building
Reply
#7
Control.GetLength() wouldn't help much since you would get the lenght of the label but not the size in pixels... For example Control.GetLength() would return 5 for "lllll" and "wwwww" but you would rather need the actual size based on the label, font and fontsize. So currently it's not possible even with a script.
Image
Reply
#8
(2012-08-17, 10:41)`Black Wrote: Control.GetLength() wouldn't help much since you would get the lenght of the label but not the size in pixels... For example Control.GetLength() would return 5 for "lllll" and "wwwww" but you would rather need the actual size based on the label, font and fontsize. So currently it's not possible even with a script.

yes, that´s what i meant. returning pixels and integrated as a built-in function.
Donate: https://kodi.tv/contribute/donate (foundation), 146Gr48FqHM7TPB9q33HHv6uWpgQqdz1yk (BTC personal)
Estuary: Kodis new default skin - ExtendedInfo Script - KodiDevKit
Reply
#9
Ok, maybe Control.GetWidth() (and Control.GetHeight()) would be better then.
Image
Reply
#10
I don't get why You want label or fadelabel based on text extent width? Or I missunderstood it?
Always read the XBMC online-manual, FAQ and search the forums before posting.
Do NOT e-mail Team-XBMC members asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting, make sure you read this first

My previous forum/trac nickname: grajen3
Reply
#11
one scenario:
if we want to show a background texture for text we have to dimension it in a way atm that the worst case is covered.
small example: background for time panel at upper right:
Image
the backgorund texture has to be shown in a way that it also covers weekdays with longer labels / different languages etc
even more amazing would the the ability to use that for animation parameters then so i could use a slide animation with end="Control.GetWidth(...)"
Donate: https://kodi.tv/contribute/donate (foundation), 146Gr48FqHM7TPB9q33HHv6uWpgQqdz1yk (BTC personal)
Estuary: Kodis new default skin - ExtendedInfo Script - KodiDevKit
Reply
#12
(2012-08-17, 15:31)pieh Wrote: I don't get why You want label or fadelabel based on text extent width? Or I missunderstood it?

Adrian wants something like this:

PHP Code:
<control type="grouplist">
    [...]
    <
control type="label" id="1">
        <
width min="10" max="500">auto</width>
        [...]
        <
visible>!IntegerGreaterThan(Control.GetWidth(1),499)</visible>
    </
control>
    <
control type="fadelabel" id="2">
        <
width>500</width>
        [...]
        <
visible>IntegerGreaterThan(Control.GetWidth(1),499)</visible>
    </
control>
    [...]
</
control
Image
Reply
#13
Exactly what I was looking for...
Maybe in the future it will work.
Reply
#14
Why fadelabel when large and not just scrolling text? Sounds like what you really want is better scrolling in the label by default.

As for backgrounds behind labels, IMO an autosizing button could be used there in most cases.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#15
so autosizing buttons are in the works? great!
Reply

Logout Mark Read Team Forum Stats Members Help
len or length function0