Hi!<br><br><div class="gmail_quote">On Thu, Jan 26, 2012 at 4:41 PM, Andreas Raab <span dir="ltr">&lt;<a href="mailto:andreas.raab@gmx.de">andreas.raab@gmx.de</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
 <br>
  
    
  
  <div>
    <br>
    <br>
    On 1/26/2012 15:43, Guillermo Polito wrote:
    <blockquote type="cite">
      <pre> </pre>
      <br>
      <fieldset></fieldset>
      <br>
      <div>The question is:</div>
      <div><br>
      </div>
      <div>Should KeyDown, KeyUp and KeyChar events for the same key
        produce the same keyCode?  I think yes.  Because the keyCode
        indicates the key pressed in the keyboard. Doesn&#39;t it?</div>
    </blockquote>
    
    It does. Which is precisely the reason why it *can&#39;t* produce
    different values when you press the shift key with it.<br> </div></blockquote><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div bgcolor="#FFFFFF" text="#000000">
 The KEY you
    are pressing does not change depending on the modifier; your OS
    decides that the combination of the Shift key and the P key produces
    an uppercase P character. Similarly to the OS deciding that (when
    using dead keys for example) pressing the accent key followed by the
    a key produces an accented a. Would you expect the keyDown value for
    the accented a to change as well? This way lies complete madness.<br></div></blockquote><div><br>But you&#39;re talking about the keychar event and I&#39;ve not modified at all it&#39;s behavior :/.  And yes, I agree I should not do any conversion on KeyUp and KeyDown :).<br>
 </div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div bgcolor="#FFFFFF" text="#000000">
    <br>
    Maybe you don&#39;t understand what these events are used for. Consider
    you are writing a game and you&#39;re using shift and control key for
    primary and secondary weapon action. Would you expect that the
    person writing the game needs to handle all of the various control
    and shift key combos in order to find out that the user pressed the
    a key to move forward?<br></div></blockquote><div><br>Oh, yes I do understand.  Maybe I didn&#39;t explain me fine, sorry.<br><br>The main problem is that I want keycodes to be the same through the three platforms (unix, mac and windows).  And for that, I have to do a mapping somewhere (this piece of code I wrote today was to play and see how it behaves, because the codes are to be defined :) ).<br>
<br>So, I thought those conversions could be done through the <b>keymap</b> array.<br>Maybe that&#39;s not the way to do the mapping, but <i>the</i> mapping should be done somewhere.<br><br>Then, after looking at how other platforms work, I reached the conclusion that if events for the same stroke have different keycodes I don&#39;t care :), since the 
keycode should only be important for KeyUp and KeyDown and not KeyChar 
(where I should only care about charCode).<br><br></div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div bgcolor="#FFFFFF" text="#000000">
    <br>
    <blockquote type="cite">
      <div>Now, utf32Code should be only used on KeyChar events, and I
        don&#39;t care about them.</div>
      <div><br>
      </div>
      <div>How does it work now?</div>
      <div><br>
      </div>
      <div>(KeyDown, KeyUp) and KeyChar events send different keyCodes
        to the image.</div>
    </blockquote>
    <br>
    Which is exactly the right thing to do.<br></div></blockquote><div><br>I answered before :).<br> </div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
    <br>
    Cheers,<br>
      - Andreas<br></div></blockquote><div><br>Thanks, I&#39;m learning!<br>Guille<br></div></div>