Deriving Theme entries

30 views
Skip to first unread message

Bryan Buchanan

unread,
May 24, 2016, 11:14:00 PM5/24/16
to CodenameOne Discussions
I'm having trouble understanding how deriving a theme entry works in the Designer.

For example, I have a CommandList->UnSelected which had transparency, margin, padding and empty border. I then did Derive->Selected, which I would assume would have the same properties. When I run the app, the selected style isn't what I expected. If I go back to CommandList->Selected and uncheck the Derive for transparency, margin, padding and border and set them to what I have in the Unselected selector, it works as it should.

I'm obviously not understanding what Derive does.

BTW, whilst themeing is incredibly configurable, I think I spend more time chasing down getting things to work just as I want, than actually writing code.

Shai Almog

unread,
May 25, 2016, 1:06:47 AM5/25/16
to CodenameOne Discussions
Yes themeing is difficult in pretty much any elaborate platform.

Derive is relatively simplistic and gets the properties of the base. However, there are pitfalls:

You can't recurse.

E.g. it's very likely that the selected CommandList derives from CommandList and so you will end up with a conflict.

Builtin types sometimes act "oddly" with derive as they have pre-configured defaults. I would recommend not relying on derive semantics when working with a standard Codename One UIID and only using it for your own custom UIID's e.g. MyButton derive from Button makes sense but Button selected derive from Button unselected might trigger odd behavior.
Reply all
Reply to author
Forward
0 new messages