Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 316605 - [widgets] Text widget with SWT.PASSWORD does not call SWT.Traverse event
Summary: [widgets] Text widget with SWT.PASSWORD does not call SWT.Traverse event
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.5.2   Edit
Hardware: Macintosh Mac OS X
: P3 minor (vote)
Target Milestone: ---   Edit
Assignee: Scott Kovatch CLA
QA Contact: Silenio Quarti CLA
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-11 09:22 EDT by Joao Martins CLA
Modified: 2021-09-15 06:54 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 Joao Martins CLA 2010-06-11 09:22:25 EDT
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
Comment 1 Remy Suen CLA 2010-06-11 09:29:12 EDT
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();
Comment 2 Joao Martins CLA 2010-06-11 09:35:55 EDT
(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.
Comment 3 Scott Kovatch CLA 2010-06-11 13:10:35 EDT
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.
Comment 4 Joao Martins CLA 2010-06-11 13:39:35 EDT
(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.
Comment 5 Scott Kovatch CLA 2010-06-11 13:51:59 EDT
(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.
Comment 6 Eclipse Webmaster CLA 2019-09-06 15:32:09 EDT
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.
Comment 7 Eclipse Genie CLA 2021-09-15 06:54:56 EDT
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.