NAME

TUI::Dialogs::RadioButtons - radio button cluster control

HIERARCHY

TObject
  TView
    TCluster
      TRadioButtons

SYNOPSIS

use TUI::Dialogs;
use TUI::Objects;

my $bounds = TRect->new( ax => 3, ay => 2, bx => 20, by => 5 );

my $items =  TSItem->new( value => '25 lines',
    next  => TSItem->new( value => '43/50 lines',
    next  => undef,
  ),
);

my $rb = TRadioButtons->new( bounds => $bounds, strings => $items );
$dialog->insert( $rb );

DESCRIPTION

TRadioButtons implements a classic radio button group where exactly one item is selected at any time. It inherits navigation, event handling, and drawing behavior from TCluster.

Selecting a radio button automatically deselects the previously selected one. The control updates its internal value whenever the selection changes or an item is pressed.

Commonly Used Features

Typical usage is to create the TSItem chain, construct TRadioButtons with new_TRadioButtons, and insert the control into a dialog. In normal code you usually interact with the selected value through dialog data transfer rather than calling press or movedTo directly; those methods are mostly used by event handling and tests.

VARIABLES

The following global variable affects the visual rendering of TRadioButtons.

$button

Defines the character pattern used to display a single radio button item, for example ( ) .

CONSTRUCTOR

new

my $rb = TRadioButtons->new(
  bounds  => $bounds,
  strings => $items
);

Creates a new radio button cluster.

bounds

Bounding rectangle defining the position and size of the radio button group (TRect).

strings

Linked list of item descriptors used to populate the radio button labels (TSItem).

new_TRadioButtons

my $rb = new_TRadioButtons($bounds, $items);

Factory-style constructor using positional arguments.

METHODS

draw

$rb->draw();

Draws the radio button group using a radio-style selection marker.

mark

my $bool = $rb->mark($item);

Returns true if the specified item is currently selected.

movedTo

$rb->movedTo($item);

Updates the internal value when the selection cursor moves to a new item.

press

$rb->press($item);

Selects the specified item and deselects all others.

setData

$rb->setData(\@record);

Sets the stored value from an external record and synchronizes the selection state accordingly.

SEE ALSO

TUI::Dialogs::CheckBoxes, TUI::Dialogs::Dialog, TUI::Dialogs::Label, TUI::Views::Cluster

AUTHORS

Borland International (original Turbo Vision design)
J. Schneider <brickpool@cpan.org> (Perl implementation and maintenance)

COPYRIGHT AND LICENSE

Copyright (c) 1990-1994, 1997 by Borland International

Copyright (c) 2026 the "AUTHORS" as listed above.

This software is licensed under the MIT license (see the LICENSE file, which is part of the distribution).