Eclipse SWT:如何从CCombo控件获取SelectionCount?
从文本中,我可以通过以下方式完成:Eclipse SWT:如何从CCombo控件获取SelectionCount?,eclipse,combobox,swt,Eclipse,Combobox,Swt,从文本中,我可以通过以下方式完成: ((Text)control).getSelectionCount(); 但是,我如何在cmbo上访问它 ((CCombo)control).getSelectionCount(); is not implemented... 谢谢。查看Text.getSelectionCount()的实现,这很简单: Point selection = myCCombo.getSelection(); int selectionCount = selection.y -
((Text)control).getSelectionCount();
但是,我如何在cmbo上访问它
((CCombo)control).getSelectionCount(); is not implemented...
谢谢。查看
Text.getSelectionCount()
的实现,这很简单:
Point selection = myCCombo.getSelection();
int selectionCount = selection.y - selection.x;
您还可以实现自己的MyCCombo
:
class MyCCombo extends CCombo {
...
public int getSelectionCount() {
Point selection = getSelection();
return selection.y - selection.x;
}
}
我总是把“点”看作“像素”符号。。。很遗憾我错过了文本。getSelectionCount()代码。。。谢谢