<meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  
  
    <div class="moz-cite-prefix">Hello,<br>
      My event_handler experiments with the Scilab help example in
      "Event handler functions" (see below) led to nothing.  I can see
      the "event" at the bottom of the graphic window but I cannot
      arrest it in a variable. I tried this:<br>
      <br>
      <div class="refsection">
        <div class="programlisting">
          <table width="100%" border="0">
            <tbody>
              <tr>
                <td width="98%">
                  <pre class="scilabcode"><span class="scilabfkeyword">function</span> <span class="scilabfunctionid">my_eventhandler</span><span class="scilabopenclose">(</span><span class="scilabinputoutputargs">win</span><span class="scilabdefault">, </span><span class="scilabinputoutputargs">x</span><span class="scilabdefault">, </span><span class="scilabinputoutputargs">y</span><span class="scilabdefault">, </span><span class="scilabinputoutputargs">ibut</span><span class="scilabopenclose">)</span>
  <span class="scilabskeyword">if</span> <span class="scilabinputoutputargs">ibut</span><span class="scilaboperator">==-</span><span class="scilabnumber">1000</span> <span class="scilabskeyword">then</span> <span class="scilabckeyword">return</span><span class="scilabdefault">,</span><span class="scilabskeyword">end</span>
  <span class="scilabopenclose">[</span><span class="scilabinputoutputargs">x</span><span class="scilabdefault">,</span><span class="scilabinputoutputargs">y</span><span class="scilabopenclose">]</span><span class="scilaboperator">=</span><a href="xchange.html" class="scilabcommand" target="_top" rel="nofollow" link="external">xchange</a><span class="scilabopenclose">(</span><span class="scilabinputoutputargs">x</span><span class="scilabdefault">,</span><span class="scilabinputoutputargs">y</span><span class="scilabdefault">,</span><span class="scilabstring">'i2f'</span><span class="scilabopenclose">)</span>
  <a href="xinfo.html" class="scilabmacro" target="_top" rel="nofollow" link="external">xinfo</a><span class="scilabopenclose">(</span><a href="msprintf.html" class="scilabcommand" target="_top" rel="nofollow" link="external">msprintf</a><span class="scilabopenclose">(</span><span class="scilabstring">'Event code %d at mouse position is (%f,%f)'</span><span class="scilabdefault">,</span><span class="scilabinputoutputargs">ibut</span><span class="scilabdefault">,</span><span class="scilabinputoutputargs">x</span><span class="scilabdefault">,</span><span class="scilabinputoutputargs">y</span><span class="scilabopenclose">))</span>
<span class="scilabfkeyword">endfunction</span>

<a href="plot2d.html" class="scilabcommand" target="_top" rel="nofollow" link="external">plot2d</a><span class="scilabopenclose">()</span>
<span class="scilabid">fig</span> <span class="scilaboperator">=</span> <a href="gcf.html" class="scilabmacro" target="_top" rel="nofollow" link="external">gcf</a><span class="scilabopenclose">()</span> <span class="scilabdefault">;</span>
<span class="scilabid">fig</span><span class="scilaboperator">.</span><span class="scilabfield">event_handler</span> <span class="scilaboperator">=</span> <span class="scilabstring">'my_eventhandler'</span> <span class="scilabdefault">;</span>
<span class="scilabid">fig</span><span class="scilaboperator">.</span><span class="scilabfield">event_handler_enable</span> <span class="scilaboperator">=</span> <span class="scilabstring">"on"</span> <span class="scilabdefault">;</span>
<span class="scilabcomment">//now:</span>
<span class="scilabcomment">//   -  move the mouse over the graphic window</span>
<span class="scilabcomment">//   -  press and release keys shifted or not with Ctrl pressed or not</span>
<span class="scilabcomment">//   -  press button, wait a little release</span>
<span class="scilabcomment">//   -  press and release button</span>
<span class="scilabcomment">//   -  double-click button</span>

<span class="scilabid">fig</span><span class="scilaboperator">.</span><span class="scilabfield">event_handler_enable</span> <span class="scilaboperator">=</span> <span class="scilabstring">"off"</span> <span class="scilabdefault">;</span> <span class="scilabcomment">//suppress the event handler</span></pre>
                </td>
                <td valign="top"> <a
                    href="scilab://scilab.execexample/"> </a> </td>
                <td valign="top"> <a
                    href="scilab://scilab.editexample/"> </a> </td>
              </tr>
            </tbody>
          </table>
        </div>
      </div>
      <br>
      I fear I must retire to  <br>
      <pre style="font-family:Courier New;font-style:normal;font-size:13.0;"><span style="color:rgb(0,0,0);">m</span><span style="color:rgb(92,92,92);">=</span><span style="color:rgb(174,92,176);text-decoration:underline;">evstr</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(50,185,185);">x_dialog</span><span style="color:rgb(74,85,219);">(...)</span></pre>
      Jens<br>
----------------------------------------------------------------------------<br>
      <br>
      Am 13.08.2014 11:12, schrieb mottelet [via Scilab / Xcos - Mailing
      Lists Archives]:<br>
    </div>
    <blockquote style='border-left:2px solid #CCCCCC;padding:0 1em'
      cite="mid:20140813111024.Horde.Hc-sr4Z-24Ie7jJkRN_21g1@webmail2.utc.fr"
      type="cite">
      <meta http-equiv="content-type" content="text/html;
        charset=ISO-8859-1">
      <title></title>
      <p>Hello,<br>
        <br>
        IMHO, the only way to trap a keypress and get the ascii (?) code
        is to use the event_handler callback of a figure :<br>
        <br>
        function handler(x,y,ibut)<br>
        //<br>
        endfunction<br>
        <br>
        f=gcf();<br>
        f.event_handler='handler';<br>
        ​f.event_handle_enable='on';<br>
        <br>
        On my computer, I have the following mapping <br>
        <br>
        left arrow pressed : ibut=37 (released=-37)<br>
        up arrow : 38<br>
        right arrow 39<br>
        down arrow 40<br>
        <br>
        The problem is that you need to have a figure opened, and that
        this figure must have the focus.<br>
        <br>
        S.</p>
      <p>Jens <<a moz-do-not-send="true"
          href="/user/SendEmail.jtp?type=node&node=4031030&i=0"
          target="_top" rel="nofollow" link="external">[hidden email]</a>>
        a écrit :</p>
      <blockquote style='border-left:2px solid #CCCCCC;padding:0 1em' style="border-left:2px solid #CCCCCC;padding:0 1em"
        type="cite">
        <p>Hi Samuel,<br>
          ASCII representation of up, down etc. would help me if I knew
          a Scilab<br>
          command which puts the ascii value into a variable. input() is
          definitely<br>
          unable to do so.<br>
          <br>
          Jens<br>
          <br>
          <br>
          <br>
          <br>
          --<br>
          View this message in context: <a moz-do-not-send="true"
href="http://mailinglists.scilab.org/Scilab-users-Recognition-of-cursor-key-as-input-tp4031013p4031026.html"
            target="_blank" rel="nofollow" link="external">http://mailinglists.scilab.org/Scilab-users-Recognition-of-cursor-key-as-input-tp4031013p4031026.html</a><br>
          Sent from the Scilab users - Mailing Lists Archives mailing
          list archive at Nabble.com.<br>
          _______________________________________________<br>
          users mailing list<br>
          <a moz-do-not-send="true"
            href="/user/SendEmail.jtp?type=node&node=4031030&i=1"
            target="_top" rel="nofollow" link="external">[hidden email]</a>.<a
          href="orghttp://lists.scilab.org/mailman/listinfo/users"
          target="_blank">orghttp://lists.scilab.org/mailman/listinfo/users</p>
      </blockquote>
      <p><br>
        <br>
      </p>
      <br>
      _______________________________________________
      <br>
      users mailing list
      <br>
      <a moz-do-not-send="true"
        href="/user/SendEmail.jtp?type=node&node=4031030&i=2"
        target="_top" rel="nofollow" link="external">[hidden email]</a>
      <br>
      <a moz-do-not-send="true"
        href="http://lists.scilab.org/mailman/listinfo/users"
        target="_top" rel="nofollow" link="external">http://lists.scilab.org/mailman/listinfo/users</a><br>
      <br>
      <br>
      <hr noshade="noshade" size="1" color="#cccccc">
      <div style="color:#444; font: 12px
        tahoma,geneva,helvetica,arial,sans-serif;">
        <div style="font-weight:bold">If you reply to this email, your
          message will be added to the discussion below:</div>
        <a moz-do-not-send="true"
href="http://mailinglists.scilab.org/Scilab-users-Recognition-of-cursor-key-as-input-tp4031013p4031030.html" target="_top" rel="nofollow" link="external">http://mailinglists.scilab.org/Scilab-users-Recognition-of-cursor-key-as-input-tp4031013p4031030.html</a>
      </div>
      <div style="color:#666; font: 11px
tahoma,geneva,helvetica,arial,sans-serif;margin-top:.4em;line-height:1.5em">
        To unsubscribe from [Scilab-users] Recognition of cursor key as
        input, <a moz-do-not-send="true"
href="" target="_top" rel="nofollow" link="external">click
          here</a>.<br>
        <a moz-do-not-send="true"
href="http://mailinglists.scilab.org/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml" rel="nofollow" style="font:9px serif" target="_top" link="external">NAML</a> </div>
    </blockquote>
    <br>
  



        
        
        
<br/><hr align="left" width="300" />
View this message in context: <a href="http://mailinglists.scilab.org/Scilab-users-Recognition-of-cursor-key-as-input-tp4031013p4031031.html">Re: Recognition of cursor key as input</a><br/>
Sent from the <a href="http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html">Scilab users - Mailing Lists Archives mailing list archive</a> at Nabble.com.<br/>