In your click handler you can check if the Ctrl key is pressed when the event was fired, see example below. You also might want to check for the specific mouse button the user clicked on. I've also added that to the example: yourLabel.
AddClickHandler(new ClickHandler() { if(NativeEvent. BUTTON_LEFT == event.getNativeButton() && event. IsControlKeyDown()) { //do what you want } }) Or for older version of GWT instead of event.
IsControlKeyDown use event.getNativeEvent().getCtrlKey() which returns a boolean value true if the control key is pressed when this event is fired.
In your click handler you can check if the Ctrl key is pressed when the event was fired, see example below. You also might want to check for the specific mouse button the user clicked on. I've also added that to the example: yourLabel.
AddClickHandler(new ClickHandler() { if(NativeEvent. BUTTON_LEFT == event.getNativeButton() && event. IsControlKeyDown()) { //do what you want } }); Or for older version of GWT instead of event.
IsControlKeyDown use event.getNativeEvent().getCtrlKey(), which returns a boolean value true if the control key is pressed when this event is fired.
Edit: this code is buggy, please look at lbrand's answer To be honest, I don't think you can do it with 1 or 2 handlers. I think you would need 3 handler. A KeyDownHandler that sets a boolean you can later read form the MouseDownHandler A MouseDownHandler that does what you want A KeyUpHandler that resets the value of the boolean in the KeyDownHandler boolean ctrlPressed; yourLabel.
AddDomHandler(new KeyDownHandler() { public void onKeyDown(KeyDownEvent event) { if(event. GetAssociatedType(). Equals(KeyCodes.
KEY_CTRL)) ctrlPressed=true; } }, KeyDownEvent.getType()); yourLabel. AddDomHandler(new KeyUpHandler() { public void onKeyUp(KeyUpEvent event) { if(event. GetAssociatedType().
Equals(KeyCodes. KEY_CTRL)) ctrlPressed=false; } }, KeyUpEvent.getType()); yourLabel. AddClickHandler(new ClickHandler() { if(ctrlPressed) { //do what you want } }).
"yourLabel. AddKeyDownHandler(new KeyDownHandler() {" – user330281 Feb 3 at 15:05 Yes, tt was, sorry. Just delete that line.
I have edited the answer. – Chris Boesing Feb 3 at 15:20 btw, is possible with overriding the onBrowserEvent? Like get the Crtl key and setting the boolean and then on click, I do whatever I want to?
– user330281 Feb 3 at 16:08 I havn't used onBrowserEvent, so I cant't answer that – Chris Boesing Feb 3 at 16:38 I've down voted this answer, because the code in this answer is buggy! The problem is when the user pressed the Ctrl Key, Widget loses focus, then the keyup event will never fire and the widget remains in the state Ctrl key pressed. The next time a user clicks on this widget, without pressing the Ctrl key it will incorrectly run as if the Ctrl key was clicked, because it still has that state.
– lbrand Bouwkamp 1 Feb3 at 9:12.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.