Skip to content

Commit

Permalink
fix component events for boxes with interactive components
Browse files Browse the repository at this point in the history
  • Loading branch information
ianharrigan committed Mar 27, 2024
1 parent ba59865 commit 7a970a7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions haxe/ui/containers/Box.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
8 changes: 7 additions & 1 deletion haxe/ui/core/ItemRenderer.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 7a970a7

Please sign in to comment.