Kodi Community Forum

Full Version: Problem using includes and constants in XML gui
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm playing with writing an add-on that uses XML files for the GUI. The problem I'm having is using includes and constants. For example, I defined a constant representing a color value (ARGB) to use with the <texturediffuse> tag. When I use the constant I don't see the texture. However, if I use the literal value for the tag, the texture is visible.
The constant definition:
<constant name='mycolor'>FFAA00AA</constant>
Anyone have
Constants are only for numeric floating point values used in coordinates (e.g. for <left> <width> etc.)
Colours are defined in the colors/defaults.xml file in the skin folder. Add-ons can't define colours or fonts, only skins can. If you want to use a colour in your add-on, you will have to input the hex value directly.

From the skinning manual:
Quote:... the <constant> tag allows you to define a numeric (floating point) constant by name for use in place of numeric values (<left>, height="" etc.) would otherwise be used. This allows alignment of items using the same position values which can then easily be altered in one place.
Skinning_Manual (wiki)
addons can not use includes, nor constants.
I want to do something similar in my addon.

The way I am planning to do this is like this:
In your addon code set the color as Skin.String
Code:
xbmc.executebuiltin('Skin.SetString(mycolor,FF12A0C7)')
In the skin xml file read the color like this:
Code:
<texturefocus colordiffuse="$INFO[Skin.String(mycolor)]">MenuItemFO.png</texturefocus>
Not sure if this approach fits your needs. Just wanted to throw it in.