Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Text-Style Underline in SWT
Text-Style Underline in SWT [message #371981] Fri, 25 July 2003 10:34 Go to next message
Eclipse UserFriend
Originally posted by: benjamin.pasero.pixelpark.com

Hello,
I wonder why there are only SWT.NORMAL, SWT.BOLD and SWT.ITALIC
supportet by SWT. I need an underline for displaying a link in a Label.
Eclipse draws an underline, so how is it done :-) ?
thx 4 help,
Ben
Re: Text-Style Underline in SWT [message #371983 is a reply to message #371981] Fri, 25 July 2003 11:02 Go to previous messageGo to next message
Ralf Koban is currently offline Ralf KobanFriend
Messages: 319
Registered: July 2009
Senior Member
Hi Benjamin,

use StyledText.

Ralf

Benjamin Pasero schrieb:
> Hello,
> I wonder why there are only SWT.NORMAL, SWT.BOLD and SWT.ITALIC
> supportet by SWT. I need an underline for displaying a link in a Label.
> Eclipse draws an underline, so how is it done :-) ?
> thx 4 help,
> Ben
>
Re: Text-Style Underline in SWT [message #371986 is a reply to message #371983] Fri, 25 July 2003 13:53 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: benjamin.pasero.pixelpark.com

Hi,
thanks for the tip, I used StyledText before in another context, but I don't
find any possibility to underline a text :-(.
In API I found:

"A StyledText is an editable user interface object that displays lines of
text. The following style attributes can be defined for the text:
- font style (bold, regular)
- ...
"

Ben

Ralf Koban schrieb:

> Hi Benjamin,
>
> use StyledText.
>
> Ralf
>
> Benjamin Pasero schrieb:
> > Hello,
> > I wonder why there are only SWT.NORMAL, SWT.BOLD and SWT.ITALIC
> > supportet by SWT. I need an underline for displaying a link in a Label.
> > Eclipse draws an underline, so how is it done :-) ?
> > thx 4 help,
> > Ben
> >
Re: Text-Style Underline in SWT [message #371987 is a reply to message #371981] Fri, 25 July 2003 14:12 Go to previous messageGo to next message
Stefan Matthias Aust is currently offline Stefan Matthias AustFriend
Messages: 68
Registered: July 2009
Member
Benjamin Pasero wrote:

> I wonder why there are only SWT.NORMAL, SWT.BOLD and SWT.ITALIC
> supportet by SWT. I need an underline for displaying a link in a Label.
> Eclipse draws an underline, so how is it done :-) ?

Draw a line yourself after determining the text width in pixels.


bye
--
Stefan Matthias Aust // "Ist es normal, nur weil alle es tun?" -F4
Re: Text-Style Underline in SWT [message #371989 is a reply to message #371986] Fri, 25 July 2003 14:42 Go to previous messageGo to next message
Ralf Koban is currently offline Ralf KobanFriend
Messages: 319
Registered: July 2009
Senior Member
Hi Benjamin,

maybe that can help you a little bit:

<eclipse-root-src>/plugins/org.eclipse.ui.workbench/Eclipse
UI/org/eclipse/ui/internal/dialogs/AboutDialog.java

Ralf

Benjamin Pasero schrieb:

> Hi,
> thanks for the tip, I used StyledText before in another context, but I don't
> find any possibility to underline a text :-(.
> In API I found:
>
> "A StyledText is an editable user interface object that displays lines of
> text. The following style attributes can be defined for the text:
> - font style (bold, regular)
> - ...
> "
>
> Ben
>
> Ralf Koban schrieb:
>
>
>>Hi Benjamin,
>>
>>use StyledText.
>>
>>Ralf
>>
>>Benjamin Pasero schrieb:
>>
>>>Hello,
>>>I wonder why there are only SWT.NORMAL, SWT.BOLD and SWT.ITALIC
>>>supportet by SWT. I need an underline for displaying a link in a Label.
>>>Eclipse draws an underline, so how is it done :-) ?
>>>thx 4 help,
>>>Ben
>>>
>
>
Re: Text-Style Underline in SWT [message #371991 is a reply to message #371986] Fri, 25 July 2003 14:44 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: tech_le_lourd.NOSPAM.yahoo.fr

Benjamin Pasero wrote:

> Hi,
> thanks for the tip, I used StyledText before in another context, but I don't
> find any possibility to underline a text :-(.
> In API I found:

> "A StyledText is an editable user interface object that displays lines of
> text. The following style attributes can be defined for the text:
> - font style (bold, regular)
> - ...
> "

Actually, you can specify a font using the setFont() method of StyledText.
There, you can undeline your text. Please refer to the SWT examples, in
the Custom Control example. You will see whait I mean :)
Re: Text-Style Underline in SWT [message #371999 is a reply to message #371991] Fri, 25 July 2003 19:37 Go to previous message
Eclipse UserFriend
Originally posted by: benjamin.pasero.pixelpark.com

Jesus, this took me a while. Didn't expect it to be so complicated,
because I never thought of an OS-dependance when dealing with underline.
Thx all for the help :-).
My Solution (Windows only):

Font systemFont = display.getSystemFont();
FontData winFontData = systemFont.getFontData()[0];
LOGFONT b = winFontData.data;
b.lfUnderline = 0x4; //Set the byte to display the underline

hope that helps some other peoples with the same prob to save some hours
;-)
Previous Topic:SWT action management
Next Topic:Table columns
Goto Forum:
  


Current Time: Wed Sep 25 18:53:57 GMT 2024

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

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

Back to the top