handle-gesture ( gesture gadget -- ? )
Factor handbook > UI framework > Implementing new gadgets > UI gestures

Prev:set-gestures ( class hash -- )
Next:gesture>string ( gesture -- string/f )


Inputs and outputs
gesturea gesture
gadgetthe receiver of the gesture
?a boolean

Generic word contract
Handles a gesture sent to a gadget.

Outputs f if the gesture was handled, and t if the gesture should be passed on to the gadget's parent.

The default implementation looks at the "gestures" word property of each superclass of the gadget's class.

Methods should be defined on this word if you desire to handle an arbitrary set of gestures. To define handlers for a fixed set, it is easier to use set-gestures. If you define a method on handle-gesture, you should also override handles-gesture?.

See also
propagate-gesture, handles-gesture?, set-gestures


GENERIC: handle-gesture ( gesture gadget -- ? )