I think you can achieve what you want by doing the same (sink in constructor + onBrowserEvent() logic) with ONKEYDOWN and ONKETUP - add a boolean variable to your class and in onBrowserEvent() set it to true when you detect ONKEYDOWN with Ctrl and set it to false similarly for ONKEYUP. Then you can check this boolean variable when you detect ONCLICK.
On May 24, 4:31 pm, zip184 <[email protected]> wrote: > Thanks for the help. I tried overriding onBrowserEvent(Event) on > MenuBar, but the Event data doesn't seem to be very helpful. I > basically need to detect a Ctrl click and/or a middle click (the way > to normally get the browser to open new tabs). So I was successful at > detecting a click like this: > > @Override > public void onBrowserEvent(Event event) { > super.onBrowserEvent(event); > if(event.getTypeInt == Event.ONCLICK) { > // your logic here > } > > } > > However event.getAltKey() always returns false and event.getButton() > always returns 1. I'm not sure why I should call > sinkEvents(Event.ONCLICK); in the constructor but I tried that too and > it doesn't seem to make a difference. Also, onBrowseEvent is called > on the entire MenuBar, and I am not able to detect which MenuItem that > the events are being called on, because I need this logic to happen > for just one of the items. -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
