SWT Cross-Platform Enter Detection

后端 未结 1 929
旧巷少年郎
旧巷少年郎 2020-12-11 17:15

I have a global filter (Display.addFilter) in SWT in which I want to detect Enter key. In Windows, pressing Enter generates SWT.CR in \'

相关标签:
1条回答
  • 2020-12-11 17:42

    If you want to catch the event when the user presses the Enter key while a widget is in focus, use a TraverseListener or a Listener with type SWT.Traverse. Then, you check

    if (event.detail == SWT.TRAVERSE_RETURN) {
        // The user pressed Enter 
    }
    
    0 讨论(0)
提交回复
热议问题