From 7a970a7d3b3d955729da4057d6b219270ad8ca14 Mon Sep 17 00:00:00 2001 From: Ian Harrigan Date: Wed, 27 Mar 2024 13:47:24 +0100 Subject: [PATCH] fix component events for boxes with interactive components --- haxe/ui/containers/Box.hx | 1 + haxe/ui/core/ItemRenderer.hx | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/haxe/ui/containers/Box.hx b/haxe/ui/containers/Box.hx index b5ec04656..cb9d45ed1 100644 --- a/haxe/ui/containers/Box.hx +++ b/haxe/ui/containers/Box.hx @@ -147,6 +147,7 @@ private class Builder extends CompositeBuilder { renderer = itemRenderer.cloneComponent(); _box.addComponent(renderer); } + renderer.itemIndex = i; _box.setComponentIndex(renderer, i); renderer.data = item; } diff --git a/haxe/ui/core/ItemRenderer.hx b/haxe/ui/core/ItemRenderer.hx index 93c233a6f..efec4c87b 100644 --- a/haxe/ui/core/ItemRenderer.hx +++ b/haxe/ui/core/ItemRenderer.hx @@ -159,7 +159,13 @@ class ItemRenderer extends Box { } var v = event.target.value; if (_data != null && event.target.id != null) { - Reflect.setProperty(_data, event.target.id, v); + var item = Reflect.getProperty(_data, event.target.id); + switch (Type.typeof(item)) { + case TObject: + item.value = v; + case _: + Reflect.setProperty(_data, event.target.id, v); + } } var e = new ItemEvent(ItemEvent.COMPONENT_EVENT);