user-input* ( str gadget -- ? )
Factor documentation > Factor handbook > UI framework > Implementing new gadgets > UI gestures > Free-form keyboard input


Vocabulary
ui.gadgets

Inputs and outputs
stra string
gadgeta gadget
?a boolean


Generic word contract
Handle free-form textual input while the gadget has keyboard focus.

Definition
IN: ui.gadgets

GENERIC: user-input* ( str gadget -- ? )


Methods
USING: accessors documents kernel ui.gadgets ui.gadgets.editors
ui.gadgets.editors.private ;

M: editor user-input*
[ selection-start/end ] [ model>> ] bi set-doc-range t ;


USING: kernel ui.gadgets ;

M: gadget user-input* 2drop t ;


USING: accessors gesture-logger io ui.gadgets ;

M: gesture-logger user-input*
stream>> [ "User input: " write print ] with-output-stream*
t ;