2009-09-11 9 views
6

Existe-t-il un moyen dans GWT pour savoir si la touche Shift est enfoncée à l'intérieur d'un gestionnaire onClick()?Majuscule dans GWT?

Par exemple:

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? 
    } 
} 

Merci!

+0

Je ne comprends pas comment cette superbe question peut avoir 100 vues et 0 votes upvotes. whisky tango foxtrot? – Epaga

Répondre

7

Qu'en est-ce (non testé)

void onClick(ClickEvent ev) { 
    NativeEvent nEv = ev.getNativeEvent(); 
    if (nEv.getShiftKey()) { 
    // event is true. 
    } 
} 
+0

cela a fonctionné parfaitement ... merci beaucoup! –

1

Et pour le clavier API a changé, mais l'idée est la même:

if (event.isShiftKeyDown()) { 
    // your code     
} 
0

GWT KeyEvent API a l'est {Alt, AnyModifier, contrôle , Meta, Shift} KeyDown() fonctions.