Hmm,  here again :)

Eclipse help page talks about keystrokes, not keychars:

http://help.eclipse.org/helios/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2Fconcepts%2Faccessibility%2Fkeyboardshortcuts.htm

And so happens in my pharo image (but not in the VM :/).  So here we have an inconsistency (keyChar event on the vm, keyChar in the HandMorph, keystroke event on the rest of the image).

Don't you think it should be named keystroke everywhere?  Because If I stroke F4, it's a kestroke.  It will not have a charCode, but It'll have a keyValue.

Guille


On Tue, Nov 22, 2011 at 3:11 PM, Guillermo Polito <guillermopolito@gmail.com> wrote:


On Tue, Nov 22, 2011 at 12:06 PM, Igor Stasenko <siguctua@gmail.com> wrote:

because these keys are not producing "characters", but they are kind
of "meta" keys which could modify the input.
as far as i understood, this line of code tells that it generates the
"KeyChar" event only if there's a character key pressed.
for other keys, like arrows, home/pgUp/pgDn etc you have key codes,
but not char codes, because there is no direct mapping between them
and any ascii/unicode character.

imagine that all keys on your keyboard having a number. Esc -  1 , F1 - 2 , etc.
So, these numbers are key codes. Now some keys can be directly
translated to characters when pressed (depending on keyboard
layout/language settings), but some of them not, and has only the key
code.

Hmm, but in my image, if I press the left arrow, I get a KeyPress :P.  So it's cheating! haha.

More, on, look at this for example:

  case XK_Left:    return 28;
    case XK_Up:        return 30;
    case XK_Right:    return 29;
    case XK_Down:    return 31;
    case XK_Insert:    return  5;
    case XK_Prior:    return 11;    /* page up */
    case XK_Next:    return 12;    /* page down */
    case XK_Home:    return  1;
    case XK_End:    return  4;

    case XK_KP_Left:    return 28;
    case XK_KP_Up:    return 30;
    case XK_KP_Right:    return 29;
    case XK_KP_Down:    return 31;
    case XK_KP_Insert:    return  5;
    case XK_KP_Prior:    return 11;    /* page up */
    case XK_KP_Next:    return 12;    /* page down */
    case XK_KP_Home:    return  1;
    case XK_KP_End:    return  4;

All those keys are treated as characters since their value is < 128 :S

What I'm wondering now is:  Should keybindings/shortcuts/"whatever name you want for them" be activated on keypress, keydown or keyup?

I'll have a look at eclipse source code xD.

Thank you very much :)
Guille