Large margins in ScrolledComposite result in too much scrolling

I have a ScrolledComposite that looks a bit like a spreadsheet. It works mostly without issue, but I sometimes have a large field that fills almost the whole line (the rightmost part).

When focus is on that field and setShowFocusedControl (true) is called, swt insists on showing the rightmost side of the field, which has the same effect as scrolling all the way to the right on a large spreadsheet - very annoying for the user as the field is rarely contains a lot of text.

Thus, the strategy chosen in the code is to constantly turn ShowFocusedControl on and off, which is very error prone.

Can anyone suggest a better strategy? Can I force swt to show the leftmost part of the focused field?

+1


a source to share


1 answer


you can use setOrigin (Point) or setOrigin (int, int) on the ScrolledComposite to set the start of the scrolled content at the top left.



+1


a source







All Articles