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

TRadioGroup

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

TRadioGroup : A group of related but mutually exclusive radio buttons, requiring the user to select one af a set of alternatives

Declaration

Source position: extctrls.pp line 716

type TRadioGroup = class(TCustomRadioGroup) end;

published

  property Align: TAlign;

  

Specifies the placement of the control inside its Parent.

  property Anchors: TAnchors;

  

The set of anchor definitions for this control.

  property AutoFill: Boolean;

  

AutoFill - whether responses to Items should automatically be filled in

  property AutoSize: Boolean;

  

Allows to automatically adjust the size of the control, according to its content.

  property BidiMode: TBiDiMode;

  property BorderSpacing: TControlBorderSpacing;

  

Determines the inner and outer border spacing for this control.

  property Caption: TCaption;

  

Caption - the text string appearing above the whole RadioGroup box

  property ChildSizing: TControlChildSizing;

  

Parameters for child control arrangement and spacing.

  property ClientHeight: Integer;

  

The height of the client area of the control.

  property ClientWidth: Integer;

  

The width of the client area of the control.

  property Color: TColor;

  

The background color of the control.

  property ColumnLayout: TColumnLayout;

  

ColumnLayout - HorizontalThenVertical or vice versa

  property Columns: Integer;

  

Columns - the number of columns in which the Items (radio buttons) are to be arranges

  property Constraints: TSizeConstraints;

  

The minimal and maximal Width and Height of this control.

  property DragCursor: TCursor;

  

The cursor shape shown while the control is dragged.

  property DragMode: TDragMode;

  

Allows the user to drag the control.

  property Enabled: Boolean;

  

Determines whether the control reacts on mouse or keyboard input.

  property Font: TFont;

  

The font to be used for text display in this control.

  property ItemIndex: Integer;

  

The Index value in the list of Items (a stringlist with the names of the selections for radio buttons)

  property Items: TStrings;

  

Items - a string list containing the captions for the radio boxes

  property OnChangeBounds: TNotifyEvent;

  

Event handler for a change of the Bounds of the control.

  property OnClick: TNotifyEvent;

  

Event called when the selected item changes

  property OnDblClick: TNotifyEvent;

  

Event Handler for double mouse clicks.

  property OnDragDrop: TDragDropEvent;

  

This handler determines the action on an drop onto this control, in a drag-drop operation.

  property OnDragOver: TDragOverEvent;

  

Event handler for a control being dragged over this control.

  property OnEndDrag: TEndDragEvent;

  

Notification handler for the end of a dragging operation.

  property OnEnter: TNotifyEvent;

  

Handler for control receiving the focus.

  property OnExit: TNotifyEvent;

  

Handler for control loosing the focus. This is a good place for checking the finished user input.

  property OnKeyDown: TKeyEvent;

  

Handler for keyboard key pressed.

  property OnKeyPress: TKeyPressEvent;

  

Handler for a character entered by the user.

  property OnKeyUp: TKeyEvent;

  

Handler for keyboard key released.

  property OnMouseDown: TMouseEvent;

  

Event handler for mouse button going down.

  property OnMouseEnter: TNotifyEvent;

  property OnMouseLeave: TNotifyEvent;

  property OnMouseMove: TMouseMoveEvent;

  

Event handler for mouse movement within the control.

  property OnMouseUp: TMouseEvent;

  

Event handler for mouse button going up.

  property OnMouseWheel: TMouseWheelEvent;

  property OnMouseWheelDown: TMouseWheelUpDownEvent;

  property OnMouseWheelUp: TMouseWheelUpDownEvent;

  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 for the start of a dragging operation.

  property OnUTF8KeyPress: TUTF8KeyPressEvent;

  

Handler for a character entered by the user.

  property ParentBidiMode: Boolean;

  property ParentFont: Boolean;

  

If true, the Font of the control will be the same as the one from the Parent. Default is true.

  property ParentColor: Boolean;

  

  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 the Hint display.

  property TabOrder: TTabOrder;

  

Determines the sequence of controls, reachable when the user presses the Tab key.

  property TabStop: Boolean;

  

Allows the user to navigate to this control, by pressing the Tab key.

  property Visible: Boolean;

  

Allows to show or hide the control, and all of its children.

Inheritance

TRadioGroup

  

TRadioGroup : A group of related but mutually exclusive radio buttons, requiring the user to select one af a set of alternatives

|

TCustomRadioGroup

  

TCustomRadioGroup: the base type for TRadioGroup

|

TCustomGroupBox

  

The base class for TGroupBox, TRadioGroup and TCheckGroup.

|

TWinControl

  

The base class for controls which can contain other (child) controls.

|

TControl

  

The base class for visible controls.

|

TLCLComponent

  

The base class for LCL components associated with widgets.

|

TComponent

?

TObject

Description

TRadioGroup: A group of related but mutually exclusive radio buttons, requiring the user to select one af 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 stringlist.

TRadioButton is an entity in itself, with a number of additional properties, whereas 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

HowToUseStdCtrls

  

How to use StdCtrls, ComCtrls or ExtCtrls

TRadioButton

  

A selection button that works with other Radio Buttons in a mutually exclusive way - if one button is selected, none of the others in the group can be selected.

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;
The latest version of this document can be found at lazarus-ccr.sourceforge.net.