Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Strikeout text in Mac OSX
Strikeout text in Mac OSX [message #663465] Tue, 05 April 2011 08:27 Go to next message
Ricky de Klerck is currently offline Ricky de KlerckFriend
Messages: 295
Registered: January 2011
Senior Member
Hi,

We're developing a RCP application but we have some trouble with the differences between Windows and Mac OSX. We want to strikeout text in a Tree, but it doens't work on Mac.

We use this to set the font:

treeItem.setFont(SWTResourceManager.getFont(String name, int size, int style, boolean strikeout, boolean underline))


but we get an error on Mac:

Unable to set underline or strikeout (probably on a non-Windows platform)


Is there another way to create a font with strikeout so it works on both Windows and Mac?


Thanks in advance!
Re: Strikeout text in Mac OSX [message #667341 is a reply to message #663465] Thu, 28 April 2011 08:56 Go to previous messageGo to next message
Ricky de Klerck is currently offline Ricky de KlerckFriend
Messages: 295
Registered: January 2011
Senior Member
I have found a solution myself.

In my treeviewer, I use a labelprovider. It now extends StyledCellLabelProvider where you can apply a style like this:

        private static Styler STRIKETHROUGH = new Styler() {
		@Override
		public void applyStyles(TextStyle textStyle) {
			textStyle.strikeout = true;
		}
	};
	
	private StyledString getStyledString(Object element) {	
		return new StyledString(getText(con),STRIKETHROUGH);
	}
	
	public void update(final ViewerCell cell) {
		Object obj = cell.getElement();
		
		cell.setFont(getFont(obj));

		StyledString styledString = getStyledString(obj);
		cell.setText(styledString.getString());
		   cell.setStyleRanges(styledString.getStyleRanges());		
	}

Re: Strikeout text in Mac OSX [message #761860 is a reply to message #667341] Wed, 07 December 2011 07:43 Go to previous messageGo to next message
Karthikeyan Missing name is currently offline Karthikeyan Missing nameFriend
Messages: 47
Registered: July 2011
Member
Hi,

Me too having the same issue. Myself need the label to be underlined or strikethrough (Font not having the same) in both windows and mac os. Kindly help me in the above code, where to use it.

Thanks & Regards,
Karthikeyan.B

[Updated on: Wed, 07 December 2011 09:10]

Report message to a moderator

Re: Strikeout text in Mac OSX [message #763470 is a reply to message #761860] Fri, 09 December 2011 20:39 Go to previous message
Ricky de Klerck is currently offline Ricky de KlerckFriend
Messages: 295
Registered: January 2011
Senior Member
I don't know where to set in a label. In my problem it was a treeviewer which sets it's labels with a labelprovider.
Previous Topic:Removing EObject from EMF Resource with RemoveCommand
Next Topic:Error While Exporting Eclipse Product
Goto Forum:
  


Current Time: Fri Apr 19 06:20:23 GMT 2024

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

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

Back to the top