tags:

views:

197

answers:

2
+2  Q: 

Shift Key in GWT?

Is there a way in GWT to tell if the shift key is down inside of an onClick() handler?

For example:

import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler;

public class PanelTileBase implements ClickHandler {

PanelTileBase()
{
 addClickHandler(this);
}

public void onClick(ClickEvent event)
{
 // is the shift key down?
}

}

Thanks!

+3  A: 

How about this (untested)

void onClick(ClickEvent ev) {
  NativeEvent nEv = ev.getNativeEvent(); 
  if ( nEv.getShiftKey() ) { 
    // event is true.
  }
}
Chris Kaminski
this worked perfectly... thanks a lot!
Soren Johnson
A: 

And for the keyboard API changed, but the idea is the same:

if (event.isShiftKeyDown()) {
    // your code                
}
Flueras Bogdan