Ignore CSS for some Widgets [message #889729] |
Tue, 19 June 2012 10:18  |
Eclipse User |
|
|
|
Hi,
we have in our Application some Labels which shows depending on a state the text in green or red (background)
This doesn't harmonise with the CSS Binding in E4, because we set the background before the CSS Databinding is running.
So the text, at first creation, no matter in what state we are, is the default color defined in CSS.
I did a workaround by adding a paint listener to the label.
label.addListener( SWT.Paint, new Listener() {
@Override
public void handleEvent(final Event event) {
if( isActive ) {
label.setBackground( green );
} else {
label.setBackground( red );
}
}
} );
But I don't like this solution, is there any other way?
|
|
|
|
|
|
Re: Ignore CSS for some Widgets [message #891505 is a reply to message #889729] |
Mon, 25 June 2012 02:14  |
Eclipse User |
|
|
|
Hi Tom,
Quote:Why are you need creating a CSS-Rule for highlighted labels?
What do you mean by that?
Current-Code:
-------------
Label l = ...
l.setForegroundColor(....)
CSS/Java-Code:
---------
Css:
Label.highlight {
color: red;
}
Java:
IStylingEngine se = ...
Label l = ...
se.setClassname("highlighted");
this seems like a good solution for us, thanks!
|
|
|
Powered by
FUDForum. Page generated in 0.47240 seconds