Is there an example how a nullable color property can be implemented with a CustomView?
corwin42 Expert Licensed User Longtime User Sep 23, 2016 #1 Is there an example how a nullable color property can be implemented with a CustomView?
Erel B4X founder Staff member Licensed User Longtime User Sep 24, 2016 #2 Now there is one: 1. Set the defaultValue to Null: B4X: @Property(key="TextColor", displayName="Text Color", defaultValue="Null", fieldType="Color") 2. Check the color value in DesignerCreateView. It will be ViewWrapper.defaultColor if the user hasn't changed it. B4X: if (textColor != ViewWrapper.defaultColor) { et.setTextColor(textColor); }
Now there is one: 1. Set the defaultValue to Null: B4X: @Property(key="TextColor", displayName="Text Color", defaultValue="Null", fieldType="Color") 2. Check the color value in DesignerCreateView. It will be ViewWrapper.defaultColor if the user hasn't changed it. B4X: if (textColor != ViewWrapper.defaultColor) { et.setTextColor(textColor); }