RadioButton

Radio button widgets are used in groups to show or change a set of mutually-exclusive options. Radio buttons have an associated selected value; when a radio button is selected, it sets the associated value.

To create a group of radio button that work properly in unison, all radio button widgets within the group must share the same immediate parent (usually a frame) and all must have individual selected values set.

Constructors

this
this(UiElement parent, string text)

Construct the widget.

this
this(string text)

Construct the widget.

Members

Functions

getSelectedValue
string getSelectedValue()

Get the value of the selected state.

select
auto select()

Select the radio button and execute the command if bound.

setSelectedValue
auto setSelectedValue(string value)

Set the value of the selected state.

Mixins

__anonymous
mixin Command

Mixin common commands.

__anonymous
mixin Invoke
Undocumented in source.
__anonymous
mixin Value!(this._valueVariable, string)
Undocumented in source.

Mixed In Members

From mixin Command

setCommand
auto setCommand(CommandCallback callback)

Add a command to a widget.

removeCommand
auto removeCommand()

Remove a previously set command.

From mixin Invoke

invokeCommand
auto invokeCommand()

Invoke the command associated with the widget.

Inherited Members

From TextWidget

_textVariable
string _textVariable;
Undocumented in source.
_image
Image _image;
Undocumented in source.
setText
auto setText(string text)

Set the widget text.

getText
string getText()

Get the widget text.

setImage
auto setImage(Image image, string imagePosition)

Set the image for this widget.

setImagePosition
auto setImagePosition(string imagePosition)

Change the position of the image in relation to the text.

setTextCharacterWidth
auto setTextCharacterWidth(int characterWidth)

Set the text character width.

destroy
void destroy()

Destroy this widget.

__anonymous
mixin Underline

Mixin common commands.

Examples

// The radio button group parent.
auto frame = new Frame()
	.pack();

auto option1 = new RadioButton(frame, "Foo")
	.setSelectedValue("foo")
	.select()
	.pack();

auto option2 = new RadioButton(frame, "Bar")
	.setSelectedValue("bar")
	.pack();

Common Commands

These are injected common commands that can also be used with this widget.

Command
Invoke
Value

Additional Events

Additional events that can also be bound to using the bind method.

<<Invoke>>, <<PrevWindow>>, <Alt-Key>, <B1-Enter>, <B1-Leave>, <Button-1>, <ButtonRelease-1>, <Enter>, <Key-Down>, <Key-F10>, <Key-Tab>, <Key-Up>, <Key-space>, <Leave>,

States: This widget does not respond to user input if the disabled state is set. The widget sets the selected state whenever the value to set to the selected value, and clears it otherwise. This widget sets the alternate state whenever value is unset. (The alternate state may be used to indicate a "tri-state" or "indeterminate" selection.)

Styles: Radio button widgets support the Toolbutton style in all standard themes, which is useful for creating widgets for toolbars.

See Also

Meta