Factor handbook > UI framework > Implementing new gadgets > UI gestures

Prev:Gesture handling differences between platforms

Commands are an abstraction layered on top of gestures. Their main advantage is that they are identified by words and can be organized into command maps. This allows easy construction of buttons and tool bars for invoking commands.
define-command ( word hash -- )

Command groups are defined on gadget classes:
define-command-map ( class group blurb pairs -- )

Commands can be introspected and invoked:
commands ( class -- hash )


invoke-command ( target command -- )

Gadgets for invoking commands are documented in Button gadgets.

When documenting gadgets, command documentation can be automatically generated:
$command-map ( element -- )

$command ( element -- )