Bug 4577 - Ctrl+Backspace & Ctrl+del have the same key code and key event (1G54RAJ)
Summary: Ctrl+Backspace & Ctrl+del have the same key code and key event (1G54RAJ)
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 2.0   Edit
Hardware: All All
: P5 major (vote)
Target Milestone: ---   Edit
Assignee: Steve Northover CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 42517 (view as bug list)
Depends on:
Blocks: 4578
  Show dependency tree
 
Reported: 2001-10-11 14:19 EDT by Mike Wilson CLA
Modified: 2003-09-04 08:34 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Wilson CLA 2001-10-11 14:19:16 EDT
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.
Comment 1 DJ Houghton CLA 2001-10-29 16:22:59 EST
PRODUCT VERSION:
platfrom 0.12b
swt  0.051
Win NT

CQ afeb771

Searched PR for Ctrl and Backspace. No PR found

Comment 2 Mike Wilson CLA 2002-05-23 16:03:48 EDT
SN to comment.
Comment 3 Mike Wilson CLA 2002-05-23 16:04:25 EDT
Not sure what the current state of this is, but no further work is planned for 
R2.0.
Comment 4 Steve Northover CLA 2002-08-13 16:59:00 EDT
ZUGBILLA!!!!!!!!!!!!!!!
Comment 5 Steve Northover CLA 2002-08-13 17:00:12 EDT
Fixed > 20020813
Comment 6 Steve Northover CLA 2002-08-15 15:30:07 EDT
Fixed > 20020815
Comment 7 attila lendvai CLA 2003-09-04 08:34:56 EDT
*** Bug 42517 has been marked as a duplicate of this bug. ***