[ < ] [ > ]   [ << ] [Plus haut] [ >> ]         [Top] [Table des matières] [Index] [ ? ]

38.17.3 Making Buttons

Buttons are associated with a region of text, using an overlay or text properties to hold button-specific information, all of which are initialized from the button's type (which defaults to the built-in button type button). Like all Emacs text, the appearance of the button is governed by the face property; by default (via the face property inherited from the button button-type) this is a simple underline, like a typical web-page link.

For convenience, there are two sorts of button-creation functions, those that add button properties to an existing region of a buffer, called make-...button, and those that also insert the button text, called insert-...button.

The button-creation functions all take the &rest argument properties, which should be a sequence of property value pairs, specifying properties to add to the button; see Button Properties. In addition, the keyword argument :type may be used to specify a button-type from which to inherit other properties; see Button Types. Any properties not explicitly specified during creation will be inherited from the button's type (if the type defines such a property).

The following functions add a button using an overlay (voir la section Overlays) to hold the button properties:

Function: make-button beg end &rest properties

This makes a button from beg to end in the current buffer, and returns it.

Function: insert-button label &rest properties

This insert a button with the label label at point, and returns it.

The following functions are similar, but use Emacs text properties (voir la section Text Properties) to hold the button properties, making the button actually part of the text instead of being a property of the buffer. Buttons using text properties do not create markers into the buffer, which is important for speed when you use extremely large numbers of buttons. Both functions return the position of the start of the new button:

Function: make-text-button beg end &rest properties

This makes a button from beg to end in the current buffer, using text properties.

Function: insert-text-button label &rest properties

This inserts a button with the label label at point, using text properties.


[ < ] [ > ]   [ << ] [Plus haut] [ >> ]         [Top] [Table des matières] [Index] [ ? ]

Ce document a été généré par Eric Reinbold le 13 Octobre 2007 en utilisant texi2html 1.78.