Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Underlined text in a Label
Underlined text in a Label [message #762986] Thu, 08 December 2011 23:04 Go to next message
Mikhail Nefedov is currently offline Mikhail NefedovFriend
Messages: 12
Registered: December 2011
Junior Member
Hello,

I am using 1.5M2.
I am unable to get underlined text in a Label after I change the Label's font... to be clear -- if I don't use the setFont() I do get the underline.
I created a custom variant in my CSS file:

Label.link {
text-decoration:underline;
}

I set the custom variant on my label like this:

label.setData( WidgetUtil.CUSTOM_VARIANT, "link" );

Is there something I am missing?

Regards,
-mikhail.




Re: Underlined text in a Label [message #763109 is a reply to message #762986] Fri, 09 December 2011 07:35 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2427
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi mikhail,
the text-decoration is currently supported only by theming. Setting the
new font will remove the decoration. If you need the decoration to be
preserved on the new set font please file an enhancement request.
Best,
Ivan

On 12/9/2011 1:04 AM, mnefedov wrote:
> Hello,
>
> I am using 1.5M2.
> I am unable to get underlined text in a Label after I change the
> Label's font... to be clear -- if I don't use the setFont() I do get
> the underline.
> I created a custom variant in my CSS file:
>
> Label.link {
> text-decoration:underline;
> }
>
> I set the custom variant on my label like this:
>
> label.setData( WidgetUtil.CUSTOM_VARIANT, "link" );
>
> Is there something I am missing?
>
> Regards,
> -mikhail.
>
>
>
>
>
Re: Underlined text in a Label [message #763136 is a reply to message #763109] Fri, 09 December 2011 08:40 Go to previous messageGo to next message
Rüdiger Herrmann is currently offline Rüdiger HerrmannFriend
Messages: 335
Registered: July 2009
Senior Member
Mikhail,

to work around this issue you may try to wrap the Label into a Composite
and set the font on this Composite.

HTH
Rüdiger

On 09.12.2011 08:35, Ivan Furnadjiev wrote:
> Hi mikhail,
> the text-decoration is currently supported only by theming. Setting the
> new font will remove the decoration. If you need the decoration to be
> preserved on the new set font please file an enhancement request.
> Best,
> Ivan
>
> On 12/9/2011 1:04 AM, mnefedov wrote:
>> Hello,
>>
>> I am using 1.5M2.
>> I am unable to get underlined text in a Label after I change the
>> Label's font... to be clear -- if I don't use the setFont() I do get
>> the underline.
>> I created a custom variant in my CSS file:
>>
>> Label.link {
>> text-decoration:underline;
>> }
>>
>> I set the custom variant on my label like this:
>>
>> label.setData( WidgetUtil.CUSTOM_VARIANT, "link" );
>>
>> Is there something I am missing?
>>
>> Regards,
>> -mikhail.
>>
>>
>>
>>
>>


--
Rüdiger Herrmann
http://codeaffine.com
Re: Underlined text in a Label [message #763282 is a reply to message #763136] Fri, 09 December 2011 13:48 Go to previous messageGo to next message
Mikhail Nefedov is currently offline Mikhail NefedovFriend
Messages: 12
Registered: December 2011
Junior Member
I need a little more guidance on this. This is what I tried, and it didn't work:


Composite composite = new Composite( parent, 0 );
composite.setFont( a_font );
// composite... layout stuff

Label label = new Label( composite, SWT.CENTER );
// NO FONT SETTING!
label.setText( a_text );
label.setData( WidgetUtil.CUSTOM_VARIANT, "link" );
// layout stuff...

Is this what you meant?

Regards,
-mikhail.



Re: Underlined text in a Label [message #763284 is a reply to message #763136] Fri, 09 December 2011 13:48 Go to previous messageGo to next message
Mikhail Nefedov is currently offline Mikhail NefedovFriend
Messages: 12
Registered: December 2011
Junior Member
I need a little more guidance on this. This is what I tried, and it didn't work:


Composite composite = new Composite( parent, 0 );
composite.setFont( a_font );
// composite... layout stuff

Label label = new Label( composite, SWT.CENTER );
// NO FONT SETTING!
label.setText( a_text );
label.setData( WidgetUtil.CUSTOM_VARIANT, "link" );
// layout stuff...

Is this what you meant?

Regards,
-mikhail.
Re: Underlined text in a Label [message #763319 is a reply to message #763282] Fri, 09 December 2011 14:56 Go to previous messageGo to next message
Rüdiger Herrmann is currently offline Rüdiger HerrmannFriend
Messages: 335
Registered: July 2009
Senior Member
yes, this is what I meant, sorry that it doesn't work. Are you aware of
the Link widget? It can be used to display text with links. The links
are underlined.

Regards,
Rüdiger

On 09.12.2011 14:48, mnefedov wrote:
> I need a little more guidance on this. This is what I tried, and it
> didn't work:
>
>
> Composite composite = new Composite( parent, 0 );
> composite.setFont( a_font );
> // composite... layout stuff
>
> Label label = new Label( composite, SWT.CENTER );
> // NO FONT SETTING!
> label.setText( a_text );
> label.setData( WidgetUtil.CUSTOM_VARIANT, "link" );
> // layout stuff...
>
> Is this what you meant?
> Regards,
> -mikhail.
--
Rüdiger Herrmann
http://codeaffine.com
Re: Underlined text in a Label [message #763335 is a reply to message #763319] Fri, 09 December 2011 15:35 Go to previous messageGo to next message
Mikhail Nefedov is currently offline Mikhail NefedovFriend
Messages: 12
Registered: December 2011
Junior Member
Yes, I did try the Link widget. The problem is that it doesn't centre properly, and it seems the size calculations are "really" off.
Re: Underlined text in a Label [message #763438 is a reply to message #763335] Fri, 09 December 2011 19:07 Go to previous messageGo to next message
Rüdiger Herrmann is currently offline Rüdiger HerrmannFriend
Messages: 335
Registered: July 2009
Senior Member
On 09.12.2011 16:35, mnefedov wrote:
> Yes, I did try the Link widget. The problem is that it doesn't centre
> properly, and it seems the size calculations are "really" off.
Hm, lot's of dead ends. Sory for that.
Would you mind to open some bugs? One (or rather two) for centering and
wrong size calculations of the Link widget.
And then one for the text-decoration. My current thinking is that it
should be possible to specify text-decoration independently of the font
settings. Hence your initial approach should work.

- Rüdiger
Re: Underlined text in a Label [message #832050 is a reply to message #763438] Thu, 29 March 2012 17:52 Go to previous messageGo to next message
Ronald So is currently offline Ronald SoFriend
Messages: 198
Registered: April 2011
Senior Member
I am using the SWT Link class to create a link in my RAP UI.

Link link = new Link(parent, SWT.NONE);
link.setText("<A>Click me</A>");


The link works fine but it is always underlined. How can I disable it through CSS?

I tried:

Link {
    text-decoration: none;
}


but it's not working.

Thanks!
Re: Underlined text in a Label [message #832081 is a reply to message #832050] Thu, 29 March 2012 18:41 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2427
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi Roland,
this is currently not possible. We have a bug opened to improve the Link
widget themability:
346438: [Theming][Link] Make Link Widget more themable
https://bugs.eclipse.org/bugs/show_bug.cgi?id=346438
Best,
Ivan

On 3/29/2012 8:52 PM, Ronald So wrote:
> I am using the SWT Link class to create a link in my RAP UI.
>
>
> Link link = new Link(parent, SWT.NONE);
> link.setText("<A>Click me</A>");
>
>
> The link works fine but it is always underlined. How can I disable it
> through CSS?
>
> I tried:
>
>
> Link {
> text-decoration: none;
> }
>
>
> but it's not working.
>
> Thanks!

--
Ivan Furnadjiev

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Underlined text in a Label [message #832091 is a reply to message #832081] Thu, 29 March 2012 19:01 Go to previous message
Ronald So is currently offline Ronald SoFriend
Messages: 198
Registered: April 2011
Senior Member
Thanks Ivan. I have added myself in the cc list and added my vote on this bug.
Previous Topic:Another &quot;First Open&quot; issue
Next Topic:Help for RAP app deployed in JBoss AS 7?
Goto Forum:
  


Current Time: Tue Oct 08 21:35:11 GMT 2024

Powered by FUDForum. Page generated in 0.05380 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top