[Overview][Types][Classes][Procedures and functions][Index] | Reference for unit 'ExtCtrls' (#lcl)

# TRadioGroup

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

TRadioGroup is a group of related but mutually exclusive radio buttons, requiring the user to select one of a set of alternatives.

## Declaration

Source position: extctrls.pp line 787

`type TRadioGroup = class(TCustomRadioGroup)`
`published`
`property Align: TAlign;` |  | Specifies the placement of the control on its Parent control.
`property Anchors: TAnchors;` |  | The set of anchor definitions for this control.
`property AutoFill: Boolean;` |  | Indicates if radio buttons are resized to fill the available space in the control.
`property AutoSize: Boolean;` |  | Allows automatic adjustment of the size for the control, according to its content.
`property BidiMode: TBiDiMode;` |  | Indicates whether text controls use in bi-directional reading.
`property BorderSpacing: TControlBorderSpacing;` |  | Determines the inner and outer border spacing for this control.
`property Caption: TCaption;` |  | The text displayed for the control.
`property ChildSizing: TControlChildSizing;` |  | Provides a grid (table) layout for the children of this control.
`property ClientHeight: Integer;` |  | The height for the client area on the control.
`property ClientWidth: Integer;` |  | The width of the client area for the control.
`property Color: TColor;` |  | The background color for the control.
`property ColumnLayout: TColumnLayout;` |  | Fill direction for columns on the grouped control.
`property Columns: Integer;` |  | Number of columns used to display radio buttons in the control.
`property Constraints: TSizeConstraints;` |  | Contains the minimum and maximum Width and Height for the control.
`property DoubleBuffered: Boolean;` |  | When enabled, it reduces flicker when the control is painted.
`property DragCursor: TCursor;` |  | The cursor shape shown during a drag operation.
`property DragMode: TDragMode;` |  | Determines how a drag operation is started for the control.
`property Enabled: Boolean;` |  | Determines whether the control responds to mouse or keyboard input.
`property Font: TFont;` |  | The font to be used for text display in this control.
`property ItemIndex: Integer;` |  | The ordinal position in Items for the selected radio button in the group.
`property Items: TStrings;` |  | Items - a string list containing the captions of the radio boxes.
`property ParentBackground: Boolean;`
`property ParentBidiMode: Boolean;` |  | Indicates whether the BiDiMode settings in the Parent control are used.
`property ParentFont: Boolean;` |  | Indicates if the Font from the Parent control is used in the control.
`property ParentColor: Boolean;` |  | Use the Color from the Parent control, when enabled.
`property ParentDoubleBuffered: Boolean;` |  | When enabled, it reduces flicker when the control is painted.
`property ParentShowHint: Boolean;` |  | If True, the value of ShowHint for the control will be the same as the one from the Parent. Default is True.
`property PopupMenu: TPopupMenu;` |  | A context-sensitive menu that pops up when the right mouse button is clicked over this control.
`property ShowHint: Boolean;` |  | Enables Hint display for the control.
`property TabOrder: TTabOrder;` |  | Indicates the navigation order for the control when the user presses the Tab or Shift+Tab key.
`property TabStop: Boolean;` |  | Allows the user to navigate to / from the control by pressing the Tab or Shift+Tab keys.
`property Visible: Boolean;` |  | Allows the control, and all of its children, to be displayed or hidden.
`property OnChangeBounds: TNotifyEvent;` |  | Event handler signalled when the Bounds for the control have been changed.
`property OnClick: TNotifyEvent;` |  | Event called when the selected item is changed.
`property OnDblClick: TNotifyEvent;` |  | Event handler signalled when a mouse double click occurs in the control.
`property OnDragDrop: TDragDropEvent;` |  | Event handler signalled when an object is dropped onto the control.
`property OnDragOver: TDragOverEvent;` |  | Event handler signalled when a control is dragged over the control instance.
`property OnEndDrag: TEndDragEvent;` |  | Event handler signalled for the end of a drag-drop operation.
`property OnEnter: TNotifyEvent;` |  | Event handler signalled when the control receives focus.
`property OnExit: TNotifyEvent;` |  | Event handler signalled when the control loses focus.
`property OnItemEnter: TNotifyEvent;` |  | Event handler signalled when a radio button in the group receives focus.
`property OnItemExit: TNotifyEvent;` |  | Event handler signalled when a radio button in the group loses focus.
`property OnKeyDown: TKeyEvent;` |  | Event handler signalled for key down keyboard events.
`property OnKeyPress: TKeyPressEvent;` |  | Event handler signalled for character data entered by the user.
`property OnKeyUp: TKeyEvent;` |  | Event handler signalled when a key up event has occurred for the control.
`property OnMouseDown: TMouseEvent;` |  | Event handler signalled when a mouse down event is handled for the control.
`property OnMouseEnter: TNotifyEvent;` |  | Event handler signalled when the mouse pointer has entered the control.
`property OnMouseLeave: TNotifyEvent;` |  | Event handler signalled when the mouse pointer has left the control.
`property OnMouseMove: TMouseMoveEvent;` |  | Event handler signalled when the mouse pointer is moved in the control.
`property OnMouseUp: TMouseEvent;` |  | Event handler signalled when a mouse up event is handled for the control.
`property OnMouseWheel: TMouseWheelEvent;` |  | Event handler for mouse wheel turned.
`property OnMouseWheelDown: TMouseWheelUpDownEvent;` |  | Event handler signalled for a downward movement of the mouse wheel.
`property OnMouseWheelUp: TMouseWheelUpDownEvent;` |  | Event handler signalled for an upward movement of the mouse wheel.
`property OnResize: TNotifyEvent;` |  | Notification handler for a resize of the control.
`property OnSelectionChanged: TNotifyEvent;` |  | Event called when the selected item changes.
`property OnStartDrag: TStartDragEvent;` |  | Event handler signalled for the start of a dragging operation.
`property OnUTF8KeyPress: TUTF8KeyPressEvent;` |  | Handler for a character entered by the user.
`end;`

## Inheritance

`TRadioGroup` |  | TRadioGroup is a group of related but mutually exclusive radio buttons, requiring the user to select one of a set of alternatives.
`TCustomRadioGroup` |  | TCustomRadioGroup is the base type for TRadioGroup.
`TCustomGroupBox` |  | The base class for TGroupBox, TRadioGroup and TCheckGroup.
`TWinControl` |  | Implements a windowed control which can contain other child controls.
`TControl` |  | The base class for visible controls.
`TLCLComponent` |  | The base class for LCL components which have an associated widget.
`TComponent`
?
`TObject`

## Description

TRadioGroup: A group of related but mutually exclusive radio buttons, requiring the user to select one of a set of alternatives. As one button becomes selected, the remaining buttons in the group become automatically deselected.

To use this control, place it in the required position on the form, then in the Object Inspector select Items and click on the ellipsis (...) to open the string editor. Type in the captions to accompany each check box, then close the string editor and you will see a series of Radio Boxes with their captions displayed beside them. (Note - unlike TCheckGroup, there is no special RadioGroup editor).

Inherits properties from TCustomRadioGroup and TCustomGroupBox.

TRadioGroup behaves differently from a group of TRadioButton controls placed arbitrarily around a form.

In the case of TRadioButton, the mutual exclusivity is a feature that applies to any RadioButton anywhere in the Form, and the RadioButtons can be rearranged in any order or placed anywhere within the containing Form, while in TRadioGroup the exclusivity applies only to buttons within the Group, which are ordered strictly according to their ItemIndex within the Items for the control.

TRadioButton is an entity unto itself with a number of additional properties. In contrast, the buttons within TRadioGroup are not separate entities, but rather are simply entries in a list of strings, each of which is associated with the on-screen image of a RadioButton.

The example shows the difference between the use of TRadioButton and TRadioGroup.

## See also

TRadioButton |  | Implement a radio button control.
How To Use Standard Controls |  | How to use StdCtrls, ComCtrls or ExtCtrls.

## Example

    {Using TRadioGroup with three entries in Items:
    Index 0: Red
    Index 1: Amber
    Index 2: Green}

    procedure TTrivialForm1.RadioGroup1Click(Sender: TObject);
    begin
      case RadioGroup1.ItemIndex of
      0:   Shape1.brush.color := clRed;
      1:   Shape1.brush.color := clYellow;
      2:   Shape1.brush.color := clGreen
      end
    end;

    {Using three separate RadioButtons}

    procedure TForm1.RadioButton1Click(Sender: TObject);
    begin
      Shape1.brush.color := clRed
    end;

    procedure TForm1.RadioButton2Click(Sender: TObject);
    begin
      Shape1.brush.color := clYellow
    end;

    procedure TForm1.RadioButton3Click(Sender: TObject);
    begin
      Shape1.brush.color := clGreen
    end;