`
lggege
  • 浏览: 372787 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

SWT 如何选中Spinner中所有的数字

    博客分类:
  • RCP
阅读更多

http://dev.eclipse.org/newslists/news.eclipse.platform.swt/msg40029.html

 

            Spinner tempSpinner = new Spinner(parent, SWT.WRAP);
            tempSpinner.setLocation(10 ,10);
            tempSpinner.setSize(100, 20);
            tempSpinner.setMinimum(0);
            tempSpinner.setMaximum(12);

            tempSpinner.setSelection(6);
            tempSpinner.setFocus();

 

                  // tempSpinner如何实现Text类似SelectAll的功能呢?

 

			public void focusGained(FocusEvent e) {
				if(e.getSource() instanceof Spinner){
					Spinner spinner = (Spinner)e.getSource();
					int hwnd = OS.GetWindow (spinner.handle, OS.GW_CHILD);
					int hwndText = OS.GetWindow (hwnd, OS.GW_HWNDNEXT);
					OS.SendMessage (hwndText, OS.EM_SETSEL, 0, -1);
				}
			}

 

 

上面的就是解决方法, 难道非要去调用OS来通知Spinner进行全选吗?

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics