Impossible to listen to keys typed in 1 buffer?
Submitted by Saturday, 5 February, 2005 - 03:43
on
Hi,
I need to get notified whenever a user types a (word constituent) key in a particular buffer because I want to make a text autocompletion feature. But so far I wasn't able to figure out how to do it. I'm only interested in keystrokes in the given buffer. 1. If I use view.setKeyEventInterceptor I grab keys from the whole view and not only the buffer (i.e. the text area) and, moreover, I prevent them from being processed further even though I call view.processKeyEvent afterwards. 2. I tried to add my listener to the textArea ( view.getTextArea() ) but there seems to be only one text area common to all buffers because when I registered it in my constructor with view.getTextArea() the listener received keys no matter what was the active buffer at the moment.
I'd very appreciate if you could advice me how to manage to listen to keys only from one buffer. Thanks! /Kuba
I need to get notified whenever a user types a (word constituent) key in a particular buffer because I want to make a text autocompletion feature. But so far I wasn't able to figure out how to do it. I'm only interested in keystrokes in the given buffer. 1. If I use view.setKeyEventInterceptor I grab keys from the whole view and not only the buffer (i.e. the text area) and, moreover, I prevent them from being processed further even though I call view.processKeyEvent afterwards. 2. I tried to add my listener to the textArea ( view.getTextArea() ) but there seems to be only one text area common to all buffers because when I registered it in my constructor with view.getTextArea() the listener received keys no matter what was the active buffer at the moment.
I'd very appreciate if you could advice me how to manage to listen to keys only from one buffer. Thanks! /Kuba