Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-swt-dev] StyledText line highlighting

Hello

I want to implement a line highlighting for the StyledText widget. It is
working fine until the content is vertically scrolled and the topPixel
is != 0.
If this happens my line highlighting does nothing.

Is there a better way to implement this or should I use another widget?

Thanks in advance
Jan Burgmeier

--------------------------------------------------------------------------

My Code:
public void set_highlighted_line(int line)
{
	Color bg_high = display.getSystemColor(SWT.COLOR_GRAY);
	Color bg_white = display.getSystemColor(SWT.COLOR_WHITE);
	
	if(highlightedLine >= 0)
	{
		lineNumberText.setLineBackground(highlightedLine, 						   1,
bg_white);
		breakPointText.setLineBackground(highlightedLine, 
						 1, bg_white);
		sourceCodeText.setLineBackground(highlightedLine, 
						 1, bg_white);
	}
		
	lineNumberText.setLineBackground(line, 1, bg_high);
	breakPointText.setLineBackground(line, 1, bg_high);
	sourceCodeText.setLineBackground(line, 1, bg_high);
		
	highlightedLine = line;
}




Back to the top