|SWT.INHERIT_DEFAULT override individual control [message #1153294]
||Thu, 24 October 2013 14:08
|| John Gymer
Registered: November 2012
Slightly tricky to describe what I'm after, so I'll try to be clear with examples...|
Let's say I have a Composite (this is RAP 2.2 by the way), which gets its background colour from the theme css. Let's call it topComp, and we set its background mode to DEFAULT:
with css for Composites like this:
linear, left top, left bottom,
from( #ffeedd ),
to( #aaccff )
So all controls placed within topComp inherit the background from it, except for some exceptions such as lists, tables, text etc.
Now, let's imagine I place another composite inside topComp, let's call it littleComp, and we place a Label inside littleComp. By default, littleComp and Label both inherit the topComp's background. Good so far, and as expected.
Now, I use setData() to define a CUSTOM_VARIANT for littleComp and also Label like this:
I also define css in the RAP theme being used:
These CSS custom variants do not get picked up at runtime - because of the INHERIT_DEFAULT specified at the higher topComp, these appear to get ignored. I have to use INHERIT_NONE to pick up prettyPink, which is no use for me.
If I try the same experiment with a Text control, the CSS theme override works ok...
Why doesn't this technique work for the label or the littleComp?
Perhaps there is a way to explicitly tell RAP/RWT that a specific control should ignore the INHERIT_DEFAULT and just use the default css theme for that control type?
What would be nice, would be something like this:
...in which case those controls would simply use the style from the css. Remember they have the RWT.CUSTOM_VARIANT="prettyPink" setData already, so perhaps they ought to be using their own css styling anyway?
Not sure if this is a bug or not, or working as designed.
Any pointers or observations greatfully accepted!
Best regards, John
Just because you can doesn't mean you should
Powered by FUDForum
. Page generated in 0.01529 seconds