First key press deleted on macOS [message #1839806] |
Mon, 29 March 2021 06:41  |
Eclipse User |
|
|
|
We have an application where the user should be able to select cells without directly starting to edit them. Instead, editing can be started by just starting typing.
@Override
protected void addEditingUIConfig() {
addConfiguration(new AbstractUiBindingConfiguration() {
@Override
public void configureUiBindings(UiBindingRegistry uiBindingRegistry) {
// Start editing when user starts typing
uiBindingRegistry.registerKeyBinding(new LetterOrDigitKeyEventMatcher(),
new KeyEditAction());
}
});
}
This works fine on Linux. Unfortunately, when the KeyEditAction is triggered on macOS, the text field content is replaced with the first pressed key, then the text field is activated which causes SWT to select all text (the single character) and as soon as the use rpresses more keys the first (selected) character is deleted.
I attached a minimal working example which should demonstrate this behavior.
This was a bit surprising to find out because the code will behave very differently on different platforms.
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.18254 seconds