Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » CTRL+ARROW_UP and CTRL+ARROW_DOWN not heard in TextEditor
CTRL+ARROW_UP and CTRL+ARROW_DOWN not heard in TextEditor [message #72955] Thu, 12 June 2003 21:14 Go to next message
Eclipse UserFriend
Originally posted by: joseph.cse.iitk.ac.in

I've made an editor that extends TextEditor. I get the editor's StyledText
by calling:

st=getSourceViewer().getTextWidget();

and then I add a VerifyKeyListener:

st.addVerifyKeyListener(new VerifyKeyListener(){
public void verifyKey(VerifyEvent e){
System.out.println("keycode="+e.keyCode+" stateMask="+e.stateMask);
}
}

and here the output in the console when the arrow keys are pressed with
the control key:

CTRL+ARROW_LEFT : keycode=16777219 stateMask=262144
CTRL+ARROW_RIGHT : keycode=16777220 stateMask=262144
CTRL+ARROW_UP : <nothing!>
CTRL+ARROW_DOWN : <nothing!>

How come CTRL+ARROW_UP and CTRL+ARROW_DOWN is not heard by the listener?
Re: CTRL+ARROW_UP and CTRL+ARROW_DOWN not heard in TextEditor [message #73085 is a reply to message #72955] Fri, 13 June 2003 01:15 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: tom.eicher.gmx.ch.nodomain

Ctrl+ARROW_UP / DOWN are ususally bound to scrolling the viewer up or down
by one - are you sure you don't have a keybinding collision on these?

-tom

"joppu" <joseph@cse.iitk.ac.in> wrote in message
news:bcb8hg$61f$1@rogue.oti.com...
> I've made an editor that extends TextEditor. I get the editor's StyledText
> by calling:
>
> st=getSourceViewer().getTextWidget();
>
> and then I add a VerifyKeyListener:
>
> st.addVerifyKeyListener(new VerifyKeyListener(){
> public void verifyKey(VerifyEvent e){
> System.out.println("keycode="+e.keyCode+"
stateMask="+e.stateMask);
> }
> }
>
> and here the output in the console when the arrow keys are pressed with
> the control key:
>
> CTRL+ARROW_LEFT : keycode=16777219 stateMask=262144
> CTRL+ARROW_RIGHT : keycode=16777220 stateMask=262144
> CTRL+ARROW_UP : <nothing!>
> CTRL+ARROW_DOWN : <nothing!>
>
> How come CTRL+ARROW_UP and CTRL+ARROW_DOWN is not heard by the listener?
>
>
>
Re: CTRL+ARROW_UP and CTRL+ARROW_DOWN not heard in TextEditor [message #73223 is a reply to message #73085] Fri, 13 June 2003 05:21 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: tom.eicher.gmx.ch.nodomain

Whether you get a VerifyKeyEvent or not depends on the position of your
listener in the StyledText - if someone else (Scroll action ...) gets the
event before you and throws an exception in its event listener, you may not
get it.

-tom
"Tom Eicher" <tom.eicher@gmx.ch.nodomain> wrote in message
news:bcbmip$en2$1@rogue.oti.com...
> Ctrl+ARROW_UP / DOWN are ususally bound to scrolling the viewer up or down
> by one - are you sure you don't have a keybinding collision on these?
>
> -tom
>
> "joppu" <joseph@cse.iitk.ac.in> wrote in message
> news:bcb8hg$61f$1@rogue.oti.com...
> > I've made an editor that extends TextEditor. I get the editor's
StyledText
> > by calling:
> >
> > st=getSourceViewer().getTextWidget();
> >
> > and then I add a VerifyKeyListener:
> >
> > st.addVerifyKeyListener(new VerifyKeyListener(){
> > public void verifyKey(VerifyEvent e){
> > System.out.println("keycode="+e.keyCode+"
> stateMask="+e.stateMask);
> > }
> > }
> >
> > and here the output in the console when the arrow keys are pressed with
> > the control key:
> >
> > CTRL+ARROW_LEFT : keycode=16777219 stateMask=262144
> > CTRL+ARROW_RIGHT : keycode=16777220 stateMask=262144
> > CTRL+ARROW_UP : <nothing!>
> > CTRL+ARROW_DOWN : <nothing!>
> >
> > How come CTRL+ARROW_UP and CTRL+ARROW_DOWN is not heard by the listener?
> >
> >
> >
>
>
Re: CTRL+ARROW_UP and CTRL+ARROW_DOWN not heard in TextEditor [message #73240 is a reply to message #72955] Fri, 13 June 2003 05:26 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: daniel.megert.gmx.net

joppu wrote:

>I've made an editor that extends TextEditor. I get the editor's StyledText
>by calling:
>
>st=getSourceViewer().getTextWidget();
>
>and then I add a VerifyKeyListener:
>
>st.addVerifyKeyListener(new VerifyKeyListener(){
> public void verifyKey(VerifyEvent e){
> System.out.println("keycode="+e.keyCode+" stateMask="+e.stateMask);
> }
>}
>
>and here the output in the console when the arrow keys are pressed with
>the control key:
>
>CTRL+ARROW_LEFT : keycode=16777219 stateMask=262144
>CTRL+ARROW_RIGHT : keycode=16777220 stateMask=262144
>CTRL+ARROW_UP : <nothing!>
>CTRL+ARROW_DOWN : <nothing!>
>
>How come CTRL+ARROW_UP and CTRL+ARROW_DOWN is not heard by the listener?
>
See Tom's comment why you do not get the event. Use a KeyListener if you
need that information.

HTH
Dani
Re: CTRL+ARROW_UP and CTRL+ARROW_DOWN not heard in TextEditor [message #74056 is a reply to message #72955] Fri, 13 June 2003 14:34 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: knut_radloff.oti.com

"joppu" <joseph@cse.iitk.ac.in> wrote in message news:bcb8hg$61f$1@rogue.oti.com...
> How come CTRL+ARROW_UP and CTRL+ARROW_DOWN is not heard by the listener?


CTRL+ARROW_UP and CTRL+ARROW_DOWN are bound to scroll line up/down by the Eclipse key binding mechanism. You should see VerifyKey
events for these if you remove the scroll line up/scroll line down key bindings in the preferences. Ctrl arrow left/right works
because they are not used by the key binding service.
You should use the key binding service if you are writing an Eclipse editor and not listen for key presses directly.

Knut
Re: CTRL+ARROW_UP and CTRL+ARROW_DOWN not heard in TextEditor [message #74215 is a reply to message #74056] Fri, 13 June 2003 18:21 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: joseph.cse.iitk.ac.in

ok...after removing the key bindings for CTRL+ARROW_UP and CTRL+ARROW_DOWN
in the preferences, they're being heard by my listener. Thanks.
How can i remove this keybinding? Do i have to define my own keybindings
for the editor?

Knut Radloff wrote:

> "joppu" <joseph@cse.iitk.ac.in> wrote in message
news:bcb8hg$61f$1@rogue.oti.com...
> > How come CTRL+ARROW_UP and CTRL+ARROW_DOWN is not heard by the listener?


> CTRL+ARROW_UP and CTRL+ARROW_DOWN are bound to scroll line up/down by the
Eclipse key binding mechanism. You should see VerifyKey
> events for these if you remove the scroll line up/scroll line down key
bindings in the preferences. Ctrl arrow left/right works
> because they are not used by the key binding service.
> You should use the key binding service if you are writing an Eclipse editor
and not listen for key presses directly.

> Knut
Re: CTRL+ARROW_UP and CTRL+ARROW_DOWN not heard in TextEditor [message #75431 is a reply to message #74215] Mon, 16 June 2003 09:41 Go to previous message
Eclipse UserFriend
Originally posted by: knut_radloff.oti.com

"joppu" <joseph@cse.iitk.ac.in> wrote in message news:bcdip7$4qr$1@rogue.oti.com...
> ok...after removing the key bindings for CTRL+ARROW_UP and CTRL+ARROW_DOWN
> in the preferences, they're being heard by my listener. Thanks.
> How can i remove this keybinding? Do i have to define my own keybindings
> for the editor?

There's a section about key bindings in the help. Search for key binding.
Apparently all you need to do is call setActionDefinitionId on your action with the id
(ITextEditorActionDefinitionIds.SCROLL_LINE_UP/SCROLL_LINE_D OWN).
There's also info in the help on how to set the command id if you're using actions sets.

Knut
Previous Topic:IAdapterFactory / IAdaptable example?
Next Topic:[howto] get the fully qualified class name of a *.class file
Goto Forum:
  


Current Time: Sun Jul 27 11:46:55 EDT 2025

Powered by FUDForum. Page generated in 0.04349 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top