Capturing arrow keys with F# and Eto.Forms
<p>Using F# and Eto.Forms on Linux, with the Gtk3 backend.</p>

<p><strong>EDIT: Adding updates to <a href="https://groups.google.com/forum/#!topic/eto-forms/8tivDpoC3Ic" rel="noreferrer">this google groups thread</a></strong>. My current best theory is that the way Eto adds keypress events to a widget in its Gtk backend does not let you capture events before a default handler both handles them and stops the signal from propagating further.</p>

<hr>

<p>I'm trying to capture KeyDown events in a form: </p>

<pre><code>let f = new Form(Topmost=true, ClientSize = new Size(600, 480))

f.KeyDown.Add(fun e -&gt;
  match e.Key with
  | Keys.Up -&gt; cursor.Move(Move_Up)
  // ...
  )
</code></pre>

<p>but I'm running into this issue:
<a href="https://stackoverflow.com/questions/1646998/up-down-left-and-right-arrow-keys-do-not-trigger-keydown-event">Up, Down, Left and Right arrow keys do not trigger KeyDown event</a></p>

<p>I cannot figure out how to follow the solution provided there (override <code>PreviewKeyDown</code> and set <code>e.IsInputKey = true</code>). I tried adding the following:</p>

<pre><code>f.PreviewKeyDown.Add(fun e -&gt; e.IsInputKey &lt;- true)
</code></pre>

<p>but that just complained that <code>f.PreviewKeyDown</code> did not exist.</p>

<hr>

<p>EDIT: It might be <a href="http://gtk-sharp.sourceforge.net/faq.html#3.3" rel="noreferrer">this Gtk#-specific issue</a> rather than the one above</p>

<blockquote>
  <p>As of release 0.15, Gtk# started using the CONNECT_AFTER flag when
  connecting event handlers to signals. This means that the event
  handlers are not run until after the default signal handlers, which
  means that the widget will be updated when the event handlers run. A
  side effect of this change is that in the case where default handlers
  return true to stop signal propagation, Gtk# events will not be
  emitted.</p>
</blockquote>

<hr>

<p>Further detail: If I hold down a modifier key as well (e.g. shift + up arrow), then <code>KeyDown</code> triggers and <code>e.Key</code> does match <code>Keys.Up</code>. Also <code>KeyUp</code> always triggers, even when <code>KeyDown</code> does not.</p>