Community
Participate
Working Groups
The same KeyEvent is passed in for two different key combinations (Windows keyboard): Ctrl+Backspace and Ctrl+Delete (or Ctrl+Del). In both cases, - KeyEvent.character is 0x7F, - keyCode is 0x0, - stateMask is SWT.CONTROL. This is unacceptable in my application (LPEX), which allows the user to customize their keys for various actions. Both Windows and AWT/Swing on Windows are able to distinguish between these keys fine. NOTES: Run testcase. Type Ctrl+Backspace Type Ctrl+Del In the console, you will see the same KeyCode: output: *********************** * KeyEvent: keyChar= (0x0), keyCode=0x40000, stateMask=<none> * KeyEvent: keyChar= (0x7F), keyCode=0x0, stateMask=Ctrl * KeyEvent: keyChar= (0x0), keyCode=0x40000, stateMask=<none> * KeyEvent: keyChar= (0x7F), keyCode=0x0, stateMask=Ctrl ********************** testcase *********************** package afeb771; import com.ibm.swt.layout.*; import com.ibm.swt.widgets.*; import com.ibm.swt.events.*; import com.ibm.swt.*; /** * */ public class Test implements KeyListener { /** * keyPressed method comment. */ public void keyPressed(KeyEvent e) { String result = "* KeyEvent: keyChar="; if (e.character >= 32 && e.character != 127) result += e.character; else result += " "; result += " (0x" + Integer.toHexString(e.character).toUpperCase() + ")"; result += ", keyCode=0x" + Integer.toHexString(e.keyCode).toUpperCase(); result += ", stateMask="; if (e.stateMask == 0) result += "<none>"; else { if ((e.stateMask & SWT.ALT) != 0) result += "Alt "; if ((e.stateMask & SWT.CONTROL) != 0) result += "Ctrl "; if ((e.stateMask & SWT.SHIFT) != 0) result += "Shift"; } System.out.println(result); } /** * keyReleased method comment. */ public void keyReleased(KeyEvent e) {} /** * */ public static void main(String[] args) { Test t = new Test(); t.start(); } /** * */ private void runEventLoop(Shell shell) { Display display = Display.getCurrent(); shell.open(); while (shell != null && !shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } } /** * */ private void start() { Shell s = new Shell(); s.setLayout(new FillLayout()); Text t = new Text(s,SWT.NONE); t.addKeyListener(this); this.runEventLoop(s); } } ********************** SN (2/5/01 3:33:48 PM) Ctrl+Bs generates a Del character on most PC keyboards. SN (2/6/01 3:19:52 PM) No plan to fix this at this time.
PRODUCT VERSION: platfrom 0.12b swt 0.051 Win NT CQ afeb771 Searched PR for Ctrl and Backspace. No PR found
SN to comment.
Not sure what the current state of this is, but no further work is planned for R2.0.
ZUGBILLA!!!!!!!!!!!!!!!
Fixed > 20020813
Fixed > 20020815
*** Bug 42517 has been marked as a duplicate of this bug. ***