Skip to content

Commit

Permalink
itemrenderer shouldnt show / hide components
Browse files Browse the repository at this point in the history
  • Loading branch information
ianharrigan committed Jul 28, 2024
1 parent 285d82d commit dd5c1bd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
14 changes: 13 additions & 1 deletion haxe/ui/core/BasicItemRenderer.hx
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -34,6 +34,18 @@ class BasicItemRenderer extends ItemRenderer {
private override function updateValues(value:Dynamic, fieldList:Array<String> = 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);
Expand Down
4 changes: 2 additions & 2 deletions haxe/ui/core/ItemRenderer.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit dd5c1bd

Please sign in to comment.