As its name suggests, PreviewNativeEvent *previews* the events, so it 
indeed runs before the event is dispatched to your code.
You'll want to listen to events that bubble up to the uppermost level 
(without being stopped by other handlers in between, such as your widget).
You can easily listen at the <body> level using 
RootPanel.get().addDomHandler(new KeyDownListener() { … }, 
KeyDownEvent.getType()) and hope it's enough (listening at the document or 
window level would require JSNI or using the experimental Elemental library)

On Thursday, April 17, 2014 10:59:58 AM UTC+2, Alex Ph wrote:
>
> Hi all,
> I have some widgets with keyDown-Bindings (e.g. F11). These keyDown 
> bindings only work when the widget got the focus. If the user leaves the 
> focus F11 triggers the browser behaviour (fullscreen). 
>
> Now I tried to deactivate the global keybindings by adding this code 
> inside the EntryPoint:
>
>          Event.addNativePreviewHandler(new Event.NativePreviewHandler() {
>>             @Override
>>             public void onPreviewNativeEvent(final NativePreviewEvent 
>> event) {
>>                if 
>> (BrowserEvents.KEYDOWN.equals(event.getNativeEvent().getType())) { //cancel 
>> event if KeyCode = F11 }
>
>             }
>>         });
>>
>
> For global stuff this works fine. But if I hit a key inside my widgets the 
> PreviewNativeEvent will be called first. If I cancel events inside this 
> event now, my local keybinding are not called. Thats how it work "by 
> design".
>
> Therefore my question: Could I hang an eventhandler between 
> GWT-Eventhandling and Browser?
>
> I found *new SchedulerImpl().scheduleFinally(new ScheduledCommand()...)*but I 
> cannot trigger an event here.
>
>
> Best Regards
> Alex
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

Reply via email to