Project: SWT
Bug 156027 VerifyEvent e.doit inconsistent behavior on Linux GTK
Reported: 2006-09-02 00:35:50 | Status: resolved fixed

Try running the code below, type in some text, select the text, and type 'a' to trigger the e.doit=false. On Windows and Mac, after pressing 'a', the selection remains selected which is what I expect. On Linux, pressing 'a' causes the selection to go away and the caret to move to the end of the selection. Is this normal behavior? public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setText("Shell"); shell.setSize(200, 200); shell.setLayout(new GridLayout()); Combo combo = new Combo(shell, SWT.NONE); combo.setLayoutData(new GridData(SWT.FILL, SWT.None, true, false)); combo.addVerifyListener(new VerifyListener() { public void verifyText(VerifyEvent e) { if (e.keyCode == 'a') { e.doit = false; } } }); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }

Files changed in fix:
bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Spinner.java bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java