[Properties (by Name)] [Methods (by Name)] [Events (by Name)]
Implement a radio button control.
Source position: stdctrls.pp line 1491
type TRadioButton = class(TCustomCheckBox) |
||
protected |
||
class procedure WSRegisterClass; override; |
|
Registers this component class with the current WidgetSet. |
procedure ApplyChanges; override; |
|
Updates the state for sibling radio buttons in the parent. |
function DialogChar(); override; |
|
Implements support for an accelerator key in the control. |
procedure RealSetText(); override; |
|
Sets the value for the text and/or caption in the control. |
procedure DoClickOnChange; override; |
|
Performs actions needed when the control has been changed using a mouse click. |
procedure CreateParams(); override; |
|
Initializes the creation parameters for the class instance. |
public |
||
constructor Create(); override; |
|
Constructor for the class instance. |
published |
||
|
Specifies the placement of the control on its Parent control. |
|
property Alignment: TLeftRight; |
|
Indicates the alignment for the caption text in the control. |
|
The set of anchor definitions for this control. |
|
property AutoSize: Boolean; |
|
Enables or disables auto-sizing the control to its content. |
property BidiMode: TBiDiMode; |
|
Customization (of text controls) in bidirectional reading environments. |
property BorderSpacing: TControlBorderSpacing; |
|
Determines the inner and outer border spacing for this control. |
|
The text displayed for the control. |
|
property Checked: Boolean; |
|
Indicates the checked state for the control. |
property Color: TGraphicsColor; |
|
The background color of the control. |
property Constraints: TSizeConstraints; |
|
Contains the minimum and maximum Width and Height for the control. |
property DoubleBuffered: Boolean; |
|
Allows to reduce flicker in the painting of the control. |
property DragCursor: TCursor; |
|
The cursor shape shown while the control is dragged. |
|
The operation when the control is dragged - Drag or Dock. |
|
|
Allows the user to drag the control. |
|
property Enabled: Boolean; |
|
Determines whether the control reacts on mouse or keyboard input. |
|
The font to be used for text display in this control. |
|
property Hint: string; |
|
The text to show in the Hint window for the control. |
property OnChange: TNotifyEvent; |
|
Event handler for changes to properties in the control. |
property OnChangeBounds: TNotifyEvent; |
|
Event handler signalled when the Bounds of the control have been changed. |
property OnClick: TNotifyEvent; |
|
Notification handler for mouse clicks. |
property OnContextPopup: TContextPopupEvent; |
|
Invoked when a context-sensitive pop-up menu is requested. |
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 drag 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. |
|
Handler for keyboard key pressed. |
|
property OnKeyPress: TKeyPressEvent; |
|
Handler for a character entered by the user. |
|
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 for mouse movement within 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 for downward movement of mouse wheel. |
property OnMouseWheelUp: TMouseWheelUpDownEvent; |
|
Event handler for upward movement of the mouse wheel. |
property OnResize: TNotifyEvent; |
|
Notification handler for a resize of the control. |
property OnStartDrag: TStartDragEvent; |
|
Event handler for the start of a dragging operation. |
property ParentBidiMode: Boolean; |
|
Indicates whether the BiDiMode settings in the Parent control are used. |
property ParentColor: Boolean; |
|
Use the Color from the Parent control, when enabled. |
property ParentDoubleBuffered: Boolean; |
|
Value for the DoubleBuffered property in a Parent control. |
property ParentFont: Boolean; |
|
If True, the Font of the control will be the same as the one from the Parent. Default is True. |
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. |
|
Indicates the navigation order for the control when the user presses the Tab or Shift+Tab key. |
|
property TabStop: Boolean; |
|
Enables navigation using the Tab key. |
property Visible: Boolean; |
|
Allows the control, and all of its children, to be displayed or hidden. |
end; |
|
Implement a radio button control. |
|
| | ||
|
The base class for a check box component. |
|
| | ||
|
Specifies a base class for button controls. |
|
| | ||
|
Implements a windowed control which can contain other child controls. |
|
| | ||
|
The base class for visible controls. |
|
| | ||
|
The base class for LCL components which have an associated widget. |
|
| | ||
TObject |
TRadioButton is a TCustomCheckBox descendant which implements a selection button that works with other radio buttons in a mutually exclusive way. If one radio button is selected, none of the others in the group can be selected.
Ensure that the OnClick event handler for each button has a unique Action, and that Actions for the other (deselected and therefore inactive) buttons are turned off.
TRadioGroup behaves differently from a group of TRadioButton controls placed on 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.
|
How to use StdCtrls, ComCtrls or ExtCtrls. |
|
|
TRadioGroup is a group of related but mutually exclusive radio buttons, requiring the user to select one of a set of alternatives. |
{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;