Hi, im using smartgwt 2.5. We are using shortcuts on Layout component. In FF to prevent Ctrl+a to select everything we use:
flowChart.addKeyPressHandler(new KeyPressHandler() {
@Override
public void onKeyPress(KeyPressEvent event) {
if (event.getKeyName().equals("A") && event.isCtrlKeyDown() && flowChart.canSelectAll()) {
...
event.cancel(); // don't propagate to browser
}
}
});
Unfortunately this does not work in Chrome. Here everything is selected even before the event is handled so im really not sure how to prevent the browser handling. But in TextItem there ctrl+a works fine so there should be a way.
Can you help me with this?
We can’t tell from this what component you’re trying this on and hence what default key handling logic your code could be interacting with. If just this code is required to reproduce a problem, can you add it to a sample to produce a test case we can run?
Hi Mismun,
You should be able to resolve this issue by intercepting the keyDown event rather than the keyPress event and cancelling that event.
This should work on all browsers (so no need for both a keyDown and keyPress event handler).
If this doesn’t behave as expected let us know and we’ll take another look.