开发者

SWT: How to getSelectionCount from a CCombo control?

开发者 https://www.devze.com 2023-04-01 15:32 出处:网络
From a TEXT i can do it through: ((Text)control).getSelectionCoun开发者_JS百科t(); But, how can i access it on a CCombo?

From a TEXT i can do it through:

((Text)control).getSelectionCoun开发者_JS百科t();

But, how can i access it on a CCombo?

((CCombo)control).getSelectionCount(); is not implemented...

Thanks.


Looking at the implementation of Text.getSelectionCount() it's trivial to do:

Point selection = myCCombo.getSelection();
int selectionCount = selection.y - selection.x;

You can also implement your own MyCCombo:

class MyCCombo extends CCombo {
   ...
   public int getSelectionCount() {
      Point selection = getSelection();
      return selection.y - selection.x;
   }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消