Howdy-
So I am writing a text editor using SWT and I want to
implement a line count pane similar to that in the workbench java editor. I figured I could use two StyledText
objects, one for the line count and one for the text editing. The problem is that I can’t get
the line count StyledText widget to resize itself correctly when I add another
digit to the line count (like going from 9 to 10 or 99 to 100). I am using a FormLayout with a
margineWidth of 2 pixels to space the line count from the editor (there are
some other complicated FormAttachments but I don’t think they
matter). When I add another digit
to the line count, I changed the width of the StyledText widget through the
setBounds method. This causes the
line count StyledText pane to overlap the editor pane… :-( What’s interesting is that when I
resize (with the mouse) the shell that contains this composite widget it
corrects the overlap and everything looks perfect. I’ve tried a lot of monkey-ing
around with various methods like redraw() and layout() but nothing has
worked. Any help would be greatly
appreciated!
While I am here I would also like to know how one can align
text in a StyledText widget. I
would like to align my line count to the right but haven’t been able to
find anything close…
Thanks,
-Donnie