Setter

Setter[x,val]

represents a setter button whose setting x is set to val when the button is clicked. The button is labeled with val, and appears pressed if the value of x is val, and unpressed otherwise.

Setter[Dynamic[x],val]

takes the setting to be the dynamically updated current value of x, with the value of x being reset if the button is clicked.

Setter[x,val,label]

labels the setter button with label.

Setter[x,{val1,val2,},label]

represents a setter button that sets x to valn if multiclicked n times.

Details and Options

  • Setter[x,val] takes x still to be val even if it is clicked more than once.
  • Setter[x,{val1,,valn},label] takes x still to be valn if it is multiclicked more than n times.
  • The following options can be given:
  • Appearance Automaticthe overall appearance of the setter
    AutoAction Falsewhether to change the setter automatically when the mouse is over it
    BaselinePosition Automaticalignment relative to surrounding text
    BaseStyle{}base style specifications for the setter
    ContentPaddingTruewhether to shrink the margins tightly around the contents
    Enabled Automaticwhether the setter is enabled or grayed out
    FrameMargins Automaticmargins to leave inside the toggler frame
    ImageMargins 0margins around the image of the displayed setter
    ImageSize Allthe overall image size of the displayed setter
  • Typical possible settings for the Appearance option include "Frameless" and "Palette". In some cases, "AbuttingLeftRight", "AbuttingRight", etc. are also supported.
  • With Appearance->None, label is displayed literally, without being placed in a button.
  • The settings for BaseStyle are appended to the default style typically given by the "Setter" style in the current stylesheet.

Examples

open allclose all

Basic Examples  (1)

A setter with the setting different from its value, showing as unpressed:

A setter with the setting equal to its value, showing as pressed:

A setter with the label α, showing unpressed and pressed states:

Dynamically set the value to 1 or 2 by clicking the respective button:

Scope  (2)

In this case, single-clicking will return 1 and double-clicking will return 2:

By triple-clicking, this setter will return the setting 3:

Options  (9)

Alignment  (1)

Align labels in the setter:

All possible alignment positions:

Appearance  (1)

Change the appearance:

AutoAction  (1)

By default, Setter must be clicked to change the setting:

By setting AutoAction->True, moving the mouse over the setter changes the setting:

Background  (1)

Change the background color:

BaselinePosition  (1)

Align with surrounding text:

Enabled  (1)

By default, Setter is enabled:

By setting Enabled->False, the setter is disabled, but visible in its current state:

FrameMargins  (1)

Increase the margins from the label to the frame:

ImageMargins  (1)

Increase the margins outside the frame:

ImageSize  (1)

Alter the overall image size:

Applications  (1)

Set the size of a graphic:

Properties & Relations  (1)

RadioButton is a special case of Setter:

Wolfram Research (2007), Setter, Wolfram Language function, https://reference.wolfram.com/language/ref/Setter.html.

Text

Wolfram Research (2007), Setter, Wolfram Language function, https://reference.wolfram.com/language/ref/Setter.html.

CMS

Wolfram Language. 2007. "Setter." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/Setter.html.

APA

Wolfram Language. (2007). Setter. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Setter.html

BibTeX

@misc{reference.wolfram_2024_setter, author="Wolfram Research", title="{Setter}", year="2007", howpublished="\url{https://reference.wolfram.com/language/ref/Setter.html}", note=[Accessed: 22-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_setter, organization={Wolfram Research}, title={Setter}, year={2007}, url={https://reference.wolfram.com/language/ref/Setter.html}, note=[Accessed: 22-November-2024 ]}