[Overview][Constants][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 921

type TRadioGroup = class(TCustomRadioGroup)

published

  property Align;

  

Used to align the control to the top, bottom, left or right of its client.

  property Anchors;

  

The set of anchor definitions for this control

  property AutoFill;

  

AutoFill - whether responses to Items should automatically be filled in

  property AutoSize;

  

Whether auto-size is to be used

  property BidiMode;

  property BorderSpacing;

  

Determines the border spacing for this control

  property Caption;

  

Caption - the text string appearing above the whole RadioGroup box

  property ChildSizing;

  

Definitions how any child control is to be sized (read/write).

  property ClientHeight;

  

ClientHeight - determines the height of the client within which the control exists

  property ClientWidth;

  

ClientWidth - determines the width of the client within which the control exists

  property Color;

  

Determine the colour for the current control

  property ColumnLayout;

  

ColumnLayout - HorizontalThenVertical or vice versa

  property Columns;

  

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

  property Constraints;

  

Determine Constraints (max and min height and width) for this control

  property DragCursor;

  

DragCursor - the style of cursor to be used during the Drag process

  property DragMode;

  

DragMode - whether manual or automatic

  property Enabled;

  

Whether the control is Enabled (read/write). If not, it usually appears 'greyed-out'

  property Font;

  

The font to be used for text in this control (read/write).

  property ItemIndex;

  

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

  property Items;

  

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

  property OnChangeBounds;

  

Event handler for a change in bounds of the control

  property OnClick;

  

Event Handler for mouse click

  property OnDblClick;

  

Event Handle for mouse double-click

  property OnDragDrop;

  

Event handler for the drop of a control onto this control.

  property OnDragOver;

  

Event handler for the case when a control is dragged over another control

  property OnEndDrag;

  

Event handler for the end of a dragging process

  property OnEnter;

  

OnEnter - event handler for when the mouse enters the control, and the control receives focus

  property OnExit;

  

OnExit - event handler for when the mouse leaves the control and it loses focus

  property OnKeyDown;

  

OnKeyDown - event handler for instance when key is down while control has focus

  property OnKeyPress;

  

OnKeyPress - event controller for a key being pressed while the control has focus. To properly handle national chars use UTF8KeyPress instead.

  property OnKeyUp;

  

OnKeyUp - event handler for instance when a key is up (not pressed) while the control has focus

  property OnMouseDown;

  

Event handler for when a mouse button is pressed down

  property OnMouseEnter;

  property OnMouseLeave;

  property OnMouseMove;

  

Event handler for mouse movement within the current control

  property OnMouseUp;

  

Event handler for when the mouse button is released, ie "up"

  property OnResize;

  

Event Handler for resize of control

  property OnStartDrag;

  

Event handler for start of dragging operation

  property OnUTF8KeyPress;

  

UTF8KeyPress - event controller for a key being pressed while the control has focus.

  property ParentBidiMode;

  property ParentFont;

  

ParentFont - should the control use the same font as the parent? Default is true

  property ParentColor;

  

  property ParentShowHint;

  

ParentShowHint - does the control adopt the same hinting behaviour as its parent? Default is true

  property PopupMenu;

  

PopupMenu - a context-sensitive menu that pops up when the right mouse button is clicked over this control

  property ShowHint;

  

Flag to determine: Is hint to be displayed for this control?

  property TabOrder;

  

The place this control occupies in the list of tabs

  property TabStop;

  

Is the control in the sequence of controls accessed by successive presses of the Tab key?

  property Visible;

  

Visible - can the control be seen?

end;

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

  

TCustomGroupBox - the base class for TGroupBox, TRadioGroup and TCheckGroup

|

TWinControl

|

TControl

|

TLCLComponent

  

TLCLComponent - base class for LCL components

|

TComponent,IUnknown,IInterfaceComponentReference

|

TPersistent

|

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

  

TRadioButton : a 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.