diff --git a/haxe/ui/core/ItemRenderer.hx b/haxe/ui/core/ItemRenderer.hx index 622248f40..5d4f0f729 100644 --- a/haxe/ui/core/ItemRenderer.hx +++ b/haxe/ui/core/ItemRenderer.hx @@ -8,6 +8,7 @@ import haxe.ui.events.ItemEvent; import haxe.ui.events.ItemRendererEvent; import haxe.ui.events.MouseEvent; import haxe.ui.events.UIEvent; +import haxe.ui.util.Color; import haxe.ui.util.TypeConverter; import haxe.ui.util.Variant; @@ -264,9 +265,9 @@ class ItemRenderer extends Box { if (property == "value") { c.value = propValue; } else if (typeInfo == "variant") { - Reflect.setProperty(c, property, Variant.fromDynamic(v)); + Reflect.setProperty(c, property, Variant.fromDynamic(propValue)); } else { - Reflect.setProperty(c, property, v); + Reflect.setProperty(c, property, propValue); } if (autoRegisterInteractiveEvents) { diff --git a/haxe/ui/macros/Macros.hx b/haxe/ui/macros/Macros.hx index 39e187c02..d7570208c 100644 --- a/haxe/ui/macros/Macros.hx +++ b/haxe/ui/macros/Macros.hx @@ -283,6 +283,7 @@ class Macros { for (f in builder.getFieldsWithMeta("style")) { f.remove(); + RTTI.addClassProperty(builder.fullPath, f.name, ComplexTypeTools.toString(f.type)); var defaultValue:Dynamic = null; if (f.isNumeric == true) { diff --git a/haxe/ui/util/RTTI.hx b/haxe/ui/util/RTTI.hx index e10f92e7d..97c49548f 100644 --- a/haxe/ui/util/RTTI.hx +++ b/haxe/ui/util/RTTI.hx @@ -21,6 +21,7 @@ class RTTI { if (propertyType == "null") propertyType = "bool"; if (propertyType == "null") propertyType = "int"; if (propertyType == "null") propertyType = "float"; + if (propertyType == "null") propertyType = "color"; if (classInfo == null) { classInfo = new Map(); diff --git a/haxe/ui/util/TypeConverter.hx b/haxe/ui/util/TypeConverter.hx index 789447999..103f9f763 100644 --- a/haxe/ui/util/TypeConverter.hx +++ b/haxe/ui/util/TypeConverter.hx @@ -49,6 +49,8 @@ class TypeConverter { return 0; } return r; + case "color": + return Color.fromString(Std.string(input)); case "variant" | "dynamic" | "scalemode" | "selectionmode" | "scrollpolicy" | "scrollmode": return input; case _: