Bug 5132 - StyledText - remove hardcoded margin
Summary: StyledText - remove hardcoded margin
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 2.0   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Lynne Kues CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-10-22 09:56 EDT by Claude Knaus CLA
Modified: 2001-10-22 15:02 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Claude Knaus CLA 2001-10-22 09:56:30 EDT
I would like to see the option to remove the (hardcoded) margin of 2 pixels.
I need this as I'm rendering a StyledText *over* another StyledText.

A simple setMargin(int marginX, int marginY) would do it for me.
As a workaround, I'm currently using a Composite to clip off the margin.
Comment 1 Lynne Kues CLA 2001-10-22 11:55:08 EDT
I'm not sure what you're saying here.  We are rendering on a canvas at x=0 on 
non-bidi platforms.  On a bidi platform we have a margin to account for the 
bidi cursor.  If you get rid of this margin, the bidi cursor will be clipped.  
Exactly where are you seeing these two pixels?  I'm not sure why this really 
matters either.  Exactly what are you trying to do?
Comment 2 Claude Knaus CLA 2001-10-22 12:49:15 EDT
I'm not using bidi. The 2 pixel border I see on the right and on the bottom of 
the widget. Run the application and select everything in the StyledText. You 
will see a two pixel thichk red line remaining. Actually, there are
very likely more pixels on the right because of the font-width bug (4664).
What I'm trying to do is to render a styled text exactly on top of a line of 
another styled text. The two pixel margin overlaps with the next line, which
is not what I want.

---8<---

package bugs;

import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class StyledTextBug {

	public static void main(String arguments[]) {
		Display display= new Display();
		Shell shell= new Shell();
		
		StyledText text= new StyledText(shell, SWT.NONE);
		text.setText
("fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo");
		text.setBackground(display.getSystemColor(SWT.COLOR_RED));
		
		shell.setLayout(new FillLayout());
		shell.pack();
		shell.open();
		
		while (!shell.isDisposed())
			if (!display.readAndDispatch())
				display.sleep();
	}
}

Comment 3 Lynne Kues CLA 2001-10-22 15:02:55 EDT
computeSize problem.  No need to add API for specifying margins.