以编程方式滚动NatTable [英] Scroll NatTable programmatically

查看:139
本文介绍了以编程方式滚动NatTable的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有关stackoverflow的第一个问题;-)

First question on stackoverflow ;-)

此处类似的问题,只有我正在尝试滚动

Similar question to here, only I am trying to scroll a NAT-Table programmatically. I can neither show a selected Item, nor set a value to the Scrollbar itself (via getHorizontalBar or similar).

据我所见,互联网没有任何答案,针对其他swt控件的建议解决方案似乎并不适用...

The internet wields no answers, as far as I could see, and solutions suggested for other swt controls do not seem to apply...

推荐答案

这取决于您要实现的目标.您是要选择一个单元格并将其移入视口,还是只是想将单元格移至视口而不进行选择?

That depends on what you are trying to achieve. Do you want to select a cell and move it into the viewport, or do you simply want to move cells into the viewport without selection?

要简单地将单元格移入视口,您应该尝试使用相应的命令来实现此目的:

For simply moving cells into the viewport you should try the corresponding commands to achieve this:

  • ShowRowInViewportCommand
  • ShowColumnInViewportCommand
  • ShowCellInViewportCommand

  • ShowRowInViewportCommand
  • ShowColumnInViewportCommand
  • ShowCellInViewportCommand

natTable.doCommand(new ShowRowInViewportCommand(gridLayer.getBodyLayer(),50));

natTable.doCommand(new ShowRowInViewportCommand(gridLayer.getBodyLayer(), 50));

要实现选择并将行移动到视口中,可以使用相应的选择命令:

To achieve selection and moving a row into the viewport, you could use the corresponding selection commands:

  • SelectRowsCommand
  • SelectColumnCommand
  • SelectCellCommand

  • SelectRowsCommand
  • SelectColumnCommand
  • SelectCellCommand

natTable.doCommand(new SelectRowsCommand(gridLayer.getBodyLayer(),0,50,false,false));

natTable.doCommand(new SelectRowsCommand(gridLayer.getBodyLayer(), 0, 50, false, false));

请注意,您需要考虑位置/索引转换,这意味着上面的语句将由于列标题而选择网格中的51行.

Note that you need to consider the position/index transformations, which means the above statement will select the 51 row in the grid because of the column header.

这篇关于以编程方式滚动NatTable的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆