Basically before a
button-down
gesture is sent, the global hand-click#
variable is incremented if necessary. Here is an example from the editor gadget:: editor-mouse-down ( editor -- )
hand-click# get {
[ ]
[ dup position-caret ]
[ dup T{ word-elt } select-elt ]
[ dup T{ one-line-elt } select-elt ]
} ?nth call drop ;
The click count is used to index an array of quotations. Nice and neat. Then we add this command to the "caret" command table:
editor "caret" {
{ "Position caret" T{ button-down } [ editor-mouse-down ] }
{ "Previous character" T{ key-down f f "LEFT" } [ T{ char-elt } editor-prev ] }
{ "Next character" T{ key-down f f "RIGHT" } [ T{ char-elt } editor-next ] }
... more commands ...
} define-commands
No comments:
Post a Comment