Next: , Previous: Programming Example, Up: Top

4 Setting Up the Buffer

Widgets are created with widget-create, which returns a widget object. This object can be queried and manipulated by other widget functions, until it is deleted with widget-delete. After the widgets have been created, widget-setup must be called to enable them.

— Function: widget-create type [ keyword argument ]...

Create and return a widget of type type. The syntax for the type argument is described in Basic Types.

The keyword arguments can be used to overwrite the keyword arguments that are part of type.

— Function: widget-delete widget

Delete widget and remove it from the buffer.

— Function: widget-setup

Set up a buffer to support widgets.

This should be called after creating all the widgets and before allowing the user to edit them.

If you want to insert text outside the widgets in the form, the recommended way to do that is with widget-insert.

— Function: widget-insert

Insert the arguments, either strings or characters, at point. The inserted text will be read-only.

There is a standard widget keymap which you might find useful.

— Const: widget-keymap

<TAB> and C-<TAB> are bound to widget-forward and widget-backward, respectively. <RET> and Mouse-2 are bound to widget-button-press and widget-button-click.

— Variable: widget-global-map

Keymap used by widget-button-press and widget-button-click when not on a button. By default this is global-map.