From dd5c1bda63914947e28fdb3f66157f5061117f4f Mon Sep 17 00:00:00 2001 From: Ian Harrigan Date: Sun, 28 Jul 2024 09:23:24 +0200 Subject: [PATCH] itemrenderer shouldnt show / hide components --- haxe/ui/core/BasicItemRenderer.hx | 14 +++++++++++++- haxe/ui/core/ItemRenderer.hx | 4 ++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/haxe/ui/core/BasicItemRenderer.hx b/haxe/ui/core/BasicItemRenderer.hx index deabe0e65..724b3a42a 100644 --- a/haxe/ui/core/BasicItemRenderer.hx +++ b/haxe/ui/core/BasicItemRenderer.hx @@ -1,9 +1,9 @@ package haxe.ui.core; -import haxe.ui.util.Color; import haxe.ui.components.Image; import haxe.ui.components.Label; import haxe.ui.containers.HBox; +import haxe.ui.util.Color; class BasicItemRenderer extends ItemRenderer { private var _icon:Image; @@ -34,6 +34,18 @@ class BasicItemRenderer extends ItemRenderer { private override function updateValues(value:Dynamic, fieldList:Array = null) { super.updateValues(value, fieldList); + if (_label.text != null) { + _label.show(); + } else { + _label.hide(); + } + + if (_icon.resource != null) { + _icon.show(); + } else { + _icon.hide(); + } + if (value != null) { if (value.color != null) { _label.customStyle.color = Color.fromString(value.color); diff --git a/haxe/ui/core/ItemRenderer.hx b/haxe/ui/core/ItemRenderer.hx index 40d1c91ac..e8cc40711 100644 --- a/haxe/ui/core/ItemRenderer.hx +++ b/haxe/ui/core/ItemRenderer.hx @@ -246,9 +246,9 @@ class ItemRenderer extends Box { setComponentProperty(c, v, property); } - c.show(); + //c.show(); } else if (c != null) { - c.hide(); + //c.hide(); } else if (f != "id" && f != "layout") { try { Reflect.setProperty(this, f, v);