Blame hig/C/spin-boxes.page

Packit 1470ea
Packit 1470ea
      xmlns:uix="http://projectmallard.org/experimental/ui/"
Packit 1470ea
      type="topic"
Packit 1470ea
      id="spin-boxes">
Packit 1470ea
Packit 1470ea
  <info>
Packit 1470ea
    <credit type="author">
Packit 1470ea
      <name>Allan Day</name>
Packit 1470ea
      <email>aday@gnome.org</email>
Packit 1470ea
    </credit>
Packit 1470ea
    <credit>
Packit 1470ea
      <name>Calum Benson</name>
Packit 1470ea
    </credit>
Packit 1470ea
    <credit>
Packit 1470ea
      <name>Adam Elman</name>
Packit 1470ea
    </credit>
Packit 1470ea
    <credit>
Packit 1470ea
      <name>Seth Nickell</name>
Packit 1470ea
    </credit>
Packit 1470ea
    <credit>
Packit 1470ea
      <name>Colin Robertson</name>
Packit 1470ea
    </credit>
Packit 1470ea
Packit 1470ea
    <link type="guide" xref="ui-elements"/>
Packit 1470ea
    <uix:thumb mime="image/svg" src="figures/ui-elements/spin-boxes.svg"/>
Packit 1470ea
Packit 1470ea
    <include href="legal.xml" xmlns="http://www.w3.org/2001/XInclude"/>
Packit 1470ea
  </info>
Packit 1470ea
Packit 1470ea
<title>Spin boxes</title>
Packit 1470ea
Packit 1470ea

A spin box is a text box that accepts a range of values. It incorporates two buttons that allow the user to increase or decrease the value by a fixed amount.

Packit 1470ea
Packit 1470ea
<media type="image" mime="image/svg" src="figures/ui-elements/spin-boxes.svg"/>
Packit 1470ea
Packit 1470ea
<section id="when-to-use">
Packit 1470ea
<title>When to use</title>
Packit 1470ea
Packit 1470ea

Use spin boxes to allow users to select numeric values, but only when those values are meaningful or useful for users to know. If they aren't, a <link xref="sliders">slider</link> might be a better choice.

Packit 1470ea
Packit 1470ea

Use spin boxes for numerical input only. For non-numeric sets of options, a <link xref="lists">list</link> or <link xref="drop-down-lists">drop-down list</link> can be used instead.

Packit 1470ea
Packit 1470ea
</section>
Packit 1470ea
Packit 1470ea
<section id="sliders">
Packit 1470ea
<title>Sliders</title>
Packit 1470ea
Packit 1470ea

In some cases, it is appropriate to link a spin button with a slider. This combination allows both approximate control and the entry of specific values. However, it is only useful if you want to cater to people who may know a specific value that they want to use. Use a slider when:

Packit 1470ea
Packit 1470ea
<list>
Packit 1470ea
<item>

Immediate feedback for changes in the spin box’s value is possible (such as in the case of image editing).

</item>
Packit 1470ea
<item>

It is useful for the user to control the rate of change of the value in real time. For example, to monitor the effects of a color change in a live preview window as they drag the RGB sliders.

</item>
Packit 1470ea
</list>
Packit 1470ea
Packit 1470ea
</section>
Packit 1470ea
Packit 1470ea
<section id="general-guidelines">
Packit 1470ea
<title>General guidelines</title>
Packit 1470ea
Packit 1470ea
<list>
Packit 1470ea
<item>

Label the spin box with a text label above it or to its left, using sentence capitalization. Provide an access key in the label that allows the user to give focus directly to the spin box.

</item>
Packit 1470ea
<item>

Right-justify the contents of spin boxes, unless the convention in the user’s locale demands otherwise. This is useful in windows where the user might want to compare two numerical values in the same column of controls. In this case, ensure the right edges of the relevant controls are also aligned.

</item>
Packit 1470ea
</list>
Packit 1470ea
Packit 1470ea
</section>
Packit 1470ea
Packit 1470ea
<section id="api-reference">
Packit 1470ea
<title>API reference</title>
Packit 1470ea
Packit 1470ea
<list>
Packit 1470ea
<item>

<link href="https://developer.gnome.org/gtk3/stable/GtkSpinButton.html">GtkSpinButton</link>

</item>
Packit 1470ea
</list>
Packit 1470ea
Packit 1470ea
</section>
Packit 1470ea
Packit 1470ea
</page>