| Summary: | Text field getText() truncates last character | ||
|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Bryan Hunt <bhunt> |
| Component: | SWT | Assignee: | Platform-SWT-Inbox <platform-swt-inbox> |
| Status: | RESOLVED WORKSFORME | QA Contact: | |
| Severity: | major | ||
| Priority: | P3 | CC: | lshanmug, ralf.teusner |
| Version: | 3.7 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Mac OS X | ||
| Whiteboard: | |||
|
Description
Bryan Hunt
I'm unable to reproduce this with HEAD. Here is the snippet I tried with and getText() works fine here. Does this work for you? Can you please post a simple snippet to show the problem?
public class Bug_338177 {
public static void main(String[] args) {
Display display = new Display();
final Shell shell = new Shell(display);
shell.setLayout(new GridLayout(1, false));
final Text text = new Text(shell, SWT.SINGLE | SWT.BORDER);
text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
text.setText("Group 2");
Button button = new Button(shell, SWT.PUSH);
button.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
button.setText("gettext");
button.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
System.out.println(text.getText());
}
});
shell.setDefaultButton(button);
shell.pack();
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
}
I'm unable to reproduce this with eclipse 3.8/4.2. Please reopen this bug if you are able to supply us with some reproducible steps. *** Bug 410623 has been marked as a duplicate of this bug. *** Hi Lakshmi, your code snippet works for me. And as of now, I can't reproduce the bug on my system any longer (changed my SDK several times since then). If I encounter it again, I will provide a small snippet, but so far no "luck". Thanks for your efforts! |