| Summary: | [widgets] Text widget with SWT.PASSWORD does not call SWT.Traverse event | ||
|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Joao Martins <joao> |
| Component: | SWT | Assignee: | Scott Kovatch <skovatch> |
| Status: | CLOSED WONTFIX | QA Contact: | Silenio Quarti <Silenio_Quarti> |
| Severity: | minor | ||
| Priority: | P3 | CC: | remy.suen, skovatch |
| Version: | 3.5.2 | ||
| Target Milestone: | --- | ||
| Hardware: | Macintosh | ||
| OS: | Mac OS X | ||
| Whiteboard: | stalebug | ||
Are you on Carbon or Cocoa?
The code below works for me when I tab around but I'm on Windows.
Display display = new Display();
Shell shell = new Shell(display);
shell.setLayout(new FillLayout());
Text text = new Text(shell, SWT.SINGLE | SWT.BORDER | SWT.PASSWORD);
text.addTraverseListener(new TraverseListener() {
public void keyTraversed(TraverseEvent e) {
System.out.println(e);
}
});
new Text(shell, SWT.SINGLE | SWT.BORDER);
shell.pack();
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
(In reply to comment #1) > Are you on Carbon or Cocoa? Cocoa > > The code below works for me when I tab around but I'm on Windows. > The problem only happens on the Mac, at Windows it works fine. Not tested at Linux. I think this may be a platform limitation. Password text cells are designed to not notify when the focus enters so you can't track the keystrokes. But I'll take a look. (In reply to comment #3) > I think this may be a platform limitation. Password text cells are designed to > not notify when the focus enters so you can't track the keystrokes. But I'll > take a look. But if the text widget is created without the SWT.PASSWORD style, and after used the .setEchoChar('*'), then the listeners are called normally. It is in fact a good idea to limit the track of keystrokes, but for some keys they should be passed, the ones from event detail field values 1<<2 to 1<<9. (In reply to comment #4) > But if the text widget is created without the SWT.PASSWORD style, and after > used the .setEchoChar('*'), then the listeners are called normally. If the widget is created with SWT.PASSWORD set we create a subclass of NSSecureTextField so you get the bullet echo characters. But that's also what prevents the focus in/out notifications needed for Traverse events. setEchoChar just changes the characters displayed in an ordinary text field. > It is in fact a good idea to limit the track of keystrokes, but for some keys > they should be passed, the ones from event detail field values 1<<2 to 1<<9. I don't disagree that this is a valid bug, but I'm not sure it's fixable while maintaining the use of NSSecureTextField. I'll see what can be done, though. This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug. If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie. |
Build Identifier: M20100211-1343 If the Text widget is created using the SWT.PASSWORD in the constructor, then the events for Traverse listeners are not called. If the constructor does NOT use SWT.PASSWORD but then is used text.setEchoChar('*') then the Traverse events are called. Reproducible: Always Steps to Reproduce: 1. create a Text widget with SWT.PASSWORD in the style field 2. add a Traverse listener 3. verify that the listener is never called