| Summary: | StyledText: problem using setHorizontalIndex when StyledText is not realized | ||
|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Felipe Heidrich <eclipse.felipe> |
| Component: | SWT | Assignee: | Felipe Heidrich <eclipse.felipe> |
| Status: | RESOLVED WONTFIX | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | cholerikasi, eclipse |
| Version: | 3.1 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | |||
| Bug Depends on: | |||
| Bug Blocks: | 93845 | ||
run the snippet, the styledtext is scrolled to the right. it is unnecessary to scroll all way to the right to show offset 22. Hi, I tried to reproduce the error but in my window it is necessary to scroll all the way to the right to show offset 22. But I'm a bit confused that the scroll bar is either moving all the way to the right (if it has to move to the right end due to the offset) or staying at it's initial position (if it has not to move completely to the right end). I checked this method again. It works fine as long as the offset is in the first line and font is fixed (monospace). Personally I would have implemented this differently but the current implementation is from 2003 I don't think we can changed it now. closing. |
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new FillLayout()); StyledText text = new StyledText (shell, SWT.V_SCROLL|SWT.H_SCROLL); // shell.open();//uncomment this line to fix the bug text.setText("public abstract class Item extends Widget {\n\n * @param parent a widget which will be the parent of the new instance (cannot be null)"); text.setHorizontalIndex(22); shell.setSize(400, 409); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }