summaryrefslogtreecommitdiff
path: root/devdocs/elisp/button-types.html
blob: 99bcd4bc27ce3daabb2ad3f0e5f8dddeb4e52b06 (plain)
1
2
3
4
5
6
7
8
9
10
 <h4 class="subsection">Button Types</h4>  <p>Every button has a <em>button type</em>, which defines default values for the button’s properties. Button types are arranged in a hierarchy, with specialized types inheriting from more general types, so that it’s easy to define special-purpose types of buttons for specific tasks. </p> <dl> <dt id="define-button-type">Function: <strong>define-button-type</strong> <em>name &amp;rest properties</em>
</dt> <dd>
<p>Define a button type called <var>name</var> (a symbol). The remaining arguments form a sequence of <var>property value</var> pairs, specifying default property values for buttons with this type (a button’s type may be set by giving it a <code>type</code> property when creating the button, using the <code>:type</code> keyword argument). </p> <p>In addition, the keyword argument <code>:supertype</code> may be used to specify a button-type from which <var>name</var> inherits its default property values. Note that this inheritance happens only when <var>name</var> is defined; subsequent changes to a supertype are not reflected in its subtypes. </p>
</dd>
</dl> <p>Using <code>define-button-type</code> to define default properties for buttons is not necessary—buttons without any specified type use the built-in button-type <code>button</code>—but it is encouraged, since doing so usually makes the resulting code clearer and more efficient. </p><div class="_attribution">
  <p class="_attribution-p">
    Copyright &copy; 1990-1996, 1998-2022 Free Software Foundation, Inc. <br>Licensed under the GNU GPL license.<br>
    <a href="https://www.gnu.org/software/emacs/manual/html_node/elisp/Button-Types.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Button-Types.html</a>
  </p>
</div>