What is the correct to set a CSS selector on a subclass [message #1061494] |
Fri, 31 May 2013 22:25  |
Eclipse User |
|
|
|
I'm trying to set the font on a eclipse ui forms widget - Section - which inherits from ExpandableComposite, which is a widget that supports custom theme-ing.
Can this be done and if so, how so I set CSS selector for it in my code?
I'm currently doing the following in code:
Section section = new Section(composite, style );
section.setData(RWT.CUSTOM_VARIANT, "viewlet_header");
section.setText(text);
In the CSS, I tried
Section.viewlet_header
viewlet_header
ExpandableComposite.viewlet_header
all to no avail.
Thanks for any help.
|
|
|
|
|
Re: What is the correct to set a CSS selector on a subclass [message #1064011 is a reply to message #1063957] |
Mon, 17 June 2013 05:17  |
Eclipse User |
|
|
|
Hi Corby,
I looked at the Section code the there is a textLabel (Label/Hyperlink
widget) responsible for the text. To change the font of this textLabel
you have to set the custom variant on that widget. Unfortunately, this
internal textLabel control is not accessible (it is protected and can be
accessed by subclasses). A style sheet like:
Label.viewlet_header {
font: 18px Arial, sans-serif;
}
should work if you manage to set the custom variant on
Section#textLabel. Don't forget that the property set by the code
overrides the property set by the theming. In other word - Section sets
the font by code automatically. If you want your theme value, you have
to reset the font to null manually first - section.setFont( null );.
From my point of view it will be easier in your case to set your
desired font programmatically and not by the theming.
HTH,
Ivan
On 6/16/2013 9:20 PM, Corby James wrote:
> Tried using the composite for the selector and its not firing. I'm
> calling the setData method on the section in the sub-class. Will that
> cause any issues?
>
> Thanks,
> Corby
--
Ivan Furnadjiev
Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/
Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
|
|
|
Powered by
FUDForum. Page generated in 0.24043 seconds