Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>So after some search, here is the solution</p> <p>In SWT you can add to display 'filter' listener instance which can modify pretty anything in the event (see <a href="http://help.eclipse.org/helios/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/widgets/Display.html#addFilter%28int,%20org.eclipse.swt.widgets.Listener%29" rel="nofollow">docs for details</a>). </p> <p><strong>Caution from Javadoc:</strong> <em>Setting the type of an event to SWT.None from within the handleEvent() method can be used to change the event type and stop subsequent Java listeners from running. Because event filters run before other listeners, event filters can both block other listeners and set arbitrary fields within an event. For this reason, event filters are both powerful and dangerous. They should generally be avoided for performance, debugging and code maintenance reasons.</em></p> <p>Here's the code (changes any typed key to <code>'l'</code> character and wrote that in console, when the event actually arise)</p> <pre><code>browser.addListener(SWT.KeyDown, new Listener() { public void handleEvent(Event event) { System.out.println(event.character); } }); display.addFilter(SWT.KeyDown, new Listener() { public void handleEvent(Event event) { if(event.widget instanceof Browser) { event.character = 'l'; } } }); </code></pre> <p><em>IMHO it's really dirty solution, implementation on browser side (by JavaScript) is much more prettier</em> </p> <p><em>Also when I'm looking to your code (don't know if it's just some testing, proof-of-concept code, anyway), using variables with <code>something_number</code> or <code>arg0</code> makes me sad. It makes code so much unreadable and obscure, try to avoid them ;]..</em></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload