If you'd like to play around with how Factor receives various inputs,
including the keyboard events, you can run the gesture-logger debug tool.
It prints out a log of all gestures received by the window so you can see
mouse movement, mouse clicks, key-up, key-down, etc:
IN: scratchpad "gesture-logger" run
I don't have a keyboard with a separate numeric pad with me to test, but I
find that behavior odd. See if the gesture logger has the same behavior,
and also, whether a key-up is ever generated for those keys. On some
platforms, you might see several key-down before a key-up for repeated keys
(like holding down a letter to type it several times).
Best,
John.
On Thu, Mar 7, 2019 at 5:01 PM KUSUMOTO Norio <[email protected]> wrote:
> Hello all,
>
> I noticed my program didn’t execute key-up hook words which were for some
> keys
> in numeric keypad on my Windows machine. It’s OK on my Mac.
> For example, so is the 1 key which is in numeric keypad. But, the normal
> 1 key is OK.
>
> When the 1 key which is in numeric keypad is hit several times, the app
> written below
> shows “down down down ...”.
> But when the normal 1 key is hit, it shows “down up! down up! down up! …”.
>
>
> test-key-up.factor :
>
> USING:
> kernel models namespaces accessors sequences
> ui ui.gadgets ui.gestures ui.commands
> ui.gadgets.worlds ui.gadgets.labels ui.gadgets.tracks ;
>
> IN: test-key-up
>
> TUPLE: key-status < model ;
>
> : <key-status> ( -- model )
> "" key-status new-model ;
>
> SYMBOL: key-status-label
> <key-status> key-status-label set-global
>
> TUPLE: key-up-gadget < track ;
>
> : <key-up-gadget> ( -- gadget )
> vertical key-up-gadget new-track
>
> key-status-label get-global <label-control>
> f track-add ;
>
> : key-down-1 ( gadget -- )
> drop
> key-status-label get-global
> dup value>> "down " append swap set-model ;
>
> : key-up-1 ( gadget -- )
> drop
> key-status-label get-global
> dup value>> "up! " append swap set-model ;
>
> : key-up-RET ( gadget -- )
> drop
> "" key-status-label get-global set-model ;
>
> key-up-gadget "gestures" f {
> { T{ key-down f f "1" } key-down-1 }
> { T{ key-up f f "1" } key-up-1 }
> { T{ key-up f f "RET" } key-up-RET }
> } define-command-map
>
> M: key-up-gadget pref-dim* drop { 800 50 } ;
>
> MAIN-WINDOW: key-up-window {
> { title "key-up test hit 1 key (RET: clear)" }
> { window-controls
> { normal-title-bar close-button minimize-button } }
> } <key-up-gadget> >>gadgets ;
>
>
>
>
> --
> KUSUMOTO Norio
>
>
>
>
>
>
>
> _______________________________________________
> Factor-talk mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk