[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.swt] Re: StyledText not working on Red Hat

SWT.CENTER is not a style that StyledText officially takes (see the class
javadoc).  You can set its alignment with StyledText.setAlignment(...).  I'm
not sure why this behaviour difference exists between win32 and gtk.

That being said, looking at your example, perhaps using a Link widget would
make more sense?  It would at least set the pointer image appropriately when
the user hovered over your link.

Grant


"Greg" <gwrobert@xxxxxxxxxx> wrote in message
news:4aea34ab85e10fcfaa1c8b28aca1087e$1@xxxxxxxxxxxxxxxxxx
> I have added a StyledText widget to my Composite in a view.
> The text appears as expected when run on Windows but when run on
> Red Hat Linux a white rectangle appears in the UI where the StyledText
> should be.
>
> I did not find a bug describing this issue so I am assuming there is
> something I can do...
>
> StyledText link = new StyledText(composite,
>                    SWT.CENTER | SWT.READ_ONLY | SWT.SINGLE);
>
> link.setBackground(composite.getBackground());
> link.setText("My Text");
>
> Color color = Display.getCurrent().getSystemColor(SWT.COLOR_BLUE);
> Color background = link.getBackground();
>
> StyleRange sr = new StyleRange(0, link.getText().length(), color,
> background);
> sr.underline = true;
> link.setStyleRange(sr);
>
> ..
>