Hi Henric,

"Henric Rosvall" <[EMAIL PROTECTED]> wrote on 03/09/2006 10:32:47 
AM:

> Now I also noticed that I don't get any mouse-events while holding Ctrl 
or 
> Shift down. So any help to solve these problems, would be much 
appreciated. 
> I'm assuming I don't only need to remove the KeyEventListeners, but also 
the 
> MouseListeners to solve this.

    If you want to turn all of this off you can simply call
'canvas.setDisableInteractions(true)' (this also disables key actions).

    Otherwise you can call the various 'setEnableXXXInteractor(false)'.
methods on the canvas to turn them on/off individually.

> 
> // Henric Rosvall
> 
> Från: Henric Rosvall [mailto:[EMAIL PROTECTED] 
> Skickat: den 9 mars 2006 16:17
> Till: [email protected]
> Ämne: Override keyevents

> I have a class that extends JSvgCanvas.
> Now I want to have my own key-event-handlers and disable the default 
ones. For
> example, I want to be able to "select" multiple objects when holding 
down the 
> Ctrl-key, but right now, holding down the Ctrl-key will make it drag a 
zoom-box instead.
> 
> I tried the following code (which will probably make more experienced 
Java-
> devellopers will probably laugh your asses of), but to no avail:
>   // Tell the Canvas not to use the Tab-key to move to the next control
>   this.setFocusTraversalKeysEnabled(false);
> 
> // Remove all the current KeyListeners
>   KeyListener[] kl = this.getKeyListeners();
>   for (int x = 0; x < kl.length; x++)
>    this.removeKeyListener(kl[x]);
> 
>   // Implement a Key-listener for Tab, Ctrl, Shift and 
Delete-Key-Presses
>   this.addKeyListener(new JSvgCanvasEnhKeyHandler());
> 
> 
> 
> Regards
> Henric Rosvall

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to