Community
Participate
Working Groups
SWT N20051127-0010 In my application I use StyledTexts (SWT.MULTI | SWT.WRAP) whose size is set dynamically to always fit the text contained in the widget. In other words, if text is set or entered for which there is not enough room, the bounds of the StyledText will be changed to make it bigger. Scrolling, if needed, happens at the level of the parent composite (a kind of scrolled composite), moving the StyledText itself along with other controls. In order for this scenario to work, it is important that the StyledText never attempt to scroll "inside itself" like it does when used as a regular editor. Instead, the top/horizontal pixel must always be (0,0). To achieve this, I found that in previous versions of StyledText it was sufficient to create a subclass that overrode the method Canvas#scroll and set it to do nothing. Due to the recent rewrite of StyledText.java, this no longer works. After some failed attempts to solve the problem by calling setTopPixel(0) and setRedraw(false/true) in the right places, I'm currently using a subclass that also overrides StyledText#scrollVertical as a new workaround. This approach has a few problems: - As before, StyledText needs to be subclassed, something which is discouraged and which I would rather avoid - Since scrollVertical is package-private, I can only override it by moving my subclass into the org.eclipse.swt.custom package where it does not really belong because it is not part of SWT - Most importantly, the workaround relies on internal details that may change at any time. The method scrollVertical might be renamed or made private, and code that invokes scrolling could also appear in other methods anywhere in the StyledText For this reason it would be extremely helpful if the StyledText widget directly supported a static, non-scrolling mode. In Swing terms, the behaviour would be like that of a JEditorPane that has not been put inside a JViewport/JScrollPane. The desired option could be controlled by a simple parameter, perhaps something like setScrollable(boolean). If set to false, this would prevent the StyledText from ever changing the viewport origin (that is, the top/horizontal pixel) or calling Canvas#scroll. Thanks in advance for considering this request. (And also thanks for continuing to improve StyledText, as in bug 83405!)
FH won't be able to look into this until well after M4.
Since this report was filed, the StyledText instances in the code I am working on have been replaced with a specialized editor widget. As this removes the original need for additional StyledText API as described above, I no longer uphold this enhancement request. If you feel that there may be other developers for whom an option to switch off StyledText's integrated viewport would be useful, you might want to keep this bug open, otherwise please feel free to close it.
Your bug has been moved to triage, visit http://www.eclipse.org/swt/triage.php for more info.