Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » StyledText Does Not Show Control Characters
StyledText Does Not Show Control Characters [message #525993] Thu, 08 April 2010 13:44 Go to next message
Bjoern Berg is currently offline Bjoern BergFriend
Messages: 41
Registered: November 2009
Location: Essen
Member
Hi,

I have a problem using StyledText for displaying Text from a file.

While every normal editor is representing control characters inside the file with a place holder, the widget StyledText is missing them or not displaying them.

Is it possible, that StyledText can also display this control characters using a place holder? If I copy the content from StyledText to an Editor like Notepad, the control characters are shown.

Any hint is welcome.

Bjoern
Re: StyledText Does Not Show Control Characters [message #526303 is a reply to message #525993] Fri, 09 April 2010 15:08 Go to previous messageGo to next message
Felipe Heidrich is currently offline Felipe HeidrichFriend
Messages: 29
Registered: July 2009
Junior Member
What control characters are you using ?

StyledText doesn't do anything for free. The application code have to filter out control characters or replace them by a place holder character of their choice.

If nothing is done, StyledText will display the control characters the way the current font defines them.

Regards,
Felipe
Re: StyledText Does Not Show Control Characters [message #526824 is a reply to message #526303] Tue, 13 April 2010 07:33 Go to previous messageGo to next message
Bjoern Berg is currently offline Bjoern BergFriend
Messages: 41
Registered: November 2009
Location: Essen
Member
Hi,

the control character is ANSI code 31. Every editor I know, displays this character as an empty square, so I had the hope that StyledText can do this automatically, because it handles newline etc. also automatically.

As Font I use Courier.

I'll try with different settings or my own replace routine for some other control characters.
icon9.gif  Re: StyledText Does Not Show Unit Separator [message #639410 is a reply to message #526824] Tue, 16 November 2010 13:09 Go to previous message
Bjoern Berg is currently offline Bjoern BergFriend
Messages: 41
Registered: November 2009
Location: Essen
Member
I still have the problem with displaying the Unit Separator (<US>, ASCII 31) in a StyledText.

I added something like

...
setFontStyle("courier", 10, "Courier New", SWT.NORMAL);
...

// transcript is the StyledText
public void setFontStyle(String description, int point, String font, int style) {
		if (transcript == null || display == null) return;
		
		if (fontRegistry == null)
			fontRegistry = new FontRegistry(display);
		
		fontRegistry.put(description, new FontData[] {new FontData(font, point, style)});
		transcript.setFont(fontRegistry.get(description));
		transcript.update();
	}


to my editor component. But StyledText does not display a Unit separator while it displays any other special ASCII character with an empty caret.

Has anyone encountered a similar problem and a fix for it?

[Updated on: Tue, 16 November 2010 13:22]

Report message to a moderator

Previous Topic:[Tree] unwanted automatic SelectionEvents
Next Topic:problem with table viewer comparator
Goto Forum:
  


Current Time: Fri Aug 23 09:38:10 GMT 2019

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

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

Back to the top