I have a ScrolledComposite which is a bit like an spreadsheet. It works mostly without problems, but I sometimes have a large field that fills almost an entire row (the rightmost part).
我有一个ScrolledComposite,有点像电子表格。它的工作原理大多没有问题,但我有时会有一个大的字段,几乎填满整行(最右边的部分)。
When focus is on this field, and setShowFocusedControl(true) has been called, swt insists on showing the rightmost part of the field, which has the same effect as scrolling all the way to the right on a big spreadsheet - it is very annoying for the user, as the field rarely has very much text in it.
当焦点在这个字段上,并且调用了setShowFocusedControl(true)时,swt坚持要显示该字段的最右边部分,这与在大型电子表格上向右滚动一样具有相同的效果 - 这对于用户,因为该字段中很少有文本。
So the strategy chosen in the code is to setShowFocusedControl on and off all the time, which is very bug-prone.
因此,代码中选择的策略是始终打开和关闭setShowFocusedControl,这非常容易出错。
Can someone suggest a better strategy? Can I make swt show the leftmost part of the focussed field?
有人可以提出更好的策略吗?我可以让swt显示聚焦场的最左边部分吗?
1 个解决方案
#1
you can use setOrigin(Point) or setOrigin(int, int) on the ScrolledComposite to set the origin of the scrolled content at the top left.
您可以在ScrolledComposite上使用setOrigin(Point)或setOrigin(int,int)来设置左上角滚动内容的原点。
#1
you can use setOrigin(Point) or setOrigin(int, int) on the ScrolledComposite to set the origin of the scrolled content at the top left.
您可以在ScrolledComposite上使用setOrigin(Point)或setOrigin(int,int)来设置左上角滚动内容的原点。