Community
Participate
Working Groups
I'm running Eclipse 3.7M5 and when I call getText() on a text field that contains the text "Group 2", I get back "Group ". The problem occurs when I press the finish button on the wizard and the text field still has focus. If I tab to the next text field, the full value of the text field will be properly returned on a call to getText(). This problem appears to be specific to Cocoa as I do not see the problem on my Linux box.
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!