[Pharo-dev] Fwd: Keyboard events is broken.

Guillermo Polito guillermopolito at gmail.com
Tue Aug 6 10:32:33 EDT 2013


On Tue, Aug 6, 2013 at 3:40 PM, Igor Stasenko <siguctua at gmail.com> wrote:

> I changed this method to see better what happens:
> HandMorph class>>showDebugEvent: evt
>
>         ShowEvents == true ifTrue: [
>                 | ofs|
>                 Display fill: (0 at 0 extent: 500 at 120) rule: Form over
> fillColor: Color white.
>                 ofs := (owner hands indexOf: self) - 1 * 60.
>                 evt printString displayAt: (0 at ofs) + (evt isKeyboard
> ifTrue: [0 at 30]
> ifFalse: [0 at 0]).
>                 self keyboardFocus printString displayAt: (0 at ofs)+(0 at 45).
>
>                 evt isKeyboard ifTrue: [  Transcript show: evt
> printString;cr ]
>                 ].
>
>
> KeyboardEvent>> printOn: aStream
>         "Print the receiver on a stream"
>
>         aStream nextPut: $[.
>         aStream nextPutAll: type; nextPutAll: ' '''.
>         self printKeyStringOn: aStream.
>         aStream nextPut: $'.
>
>         aStream space; nextPutAll: 'keyValue: ', self keyValue  asString.
>
>         aStream nextPut: $]
>
> set
> HandMorph showEvents:true
>
> Now, pressing single space, gives me this:
>
> [keyDown ' ' keyValue: 49]
> [keystroke ' ' keyValue: 32]
> [keyUp ' ' keyValue: 49]
> [keyUp ' ' keyValue: 49]
>
> Pressing delete key (or fn-backspace , for those who having a lot of
> spare fingers to use bad keyboards):
>
> [keyDown ' ' keyValue: 117]
> [keystroke '⌦' keyValue: 188]
> [keyUp ' ' keyValue: 117]
> [keyUp ' ' keyValue: 117]
>
> now, can someone tell me , why there is 2 keyUp events for each keyDown?
>

That I don't know


>
> and of course, main question is why key values are different for
> keydown and keystroke events?
>

That I'll dive right now into the vm to see what it is :).


> (and why delete key is not 127, but 117 or 188?)
>
> Editor expecting 127:
>
>         cmdMap at: (127 + 1) put: #forwardDelete:.              "del key"
>
>
>
> --
> Best regards,
> Igor Stasenko.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/attachments/20130806/a685feb8/attachment-0002.html>


More information about the Pharo-dev mailing list