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
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to