[brailleblaster] Re: The VerifyKeyListener

  • From: Michael Whapples <mwhapples@xxxxxxx>
  • To: brailleblaster@xxxxxxxxxxxxx
  • Date: Sat, 11 Jun 2011 22:33:14 +0100

Hello,
May be I have lost where we are going here, but a question which may need to be asked is, what determines if the "document" has changed? Is it as simple as only key presses in the styled text controls may change the document? Is there any other way the document may be modified? Can the view provide sufficient information of whether the document has changed? Just because a document looks the same, does that mean the actual document itself is the same?

Michael Whapples
On 06/11/11 16:51, Susan Jolly wrote:
The StyledText widget has a lot of OS-dependent default key bindings which you can discover either from its getKeyBinding() method or by looking at the source code. You can overwrite the defaults and/or set additional bindings with the widget's setKeyBinding() method. You can listen directly for SWT.Key_Down events rather than usingVerifyKeyListener. . Here is a bit of code from the TextEditor example.

styledText.addListener(SWT.KeyDown, new Listener() {
  public void handleEvent(Event event) {
   handleKeyDown(event);
  }

Then in your handleKeyDown() method you can use event.keyCode to determine which key was pressed.

Susan



Other related posts: