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

# TDBRadioGroup

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

TDBRadioGroup - a data-aware version of TRadioGroup, providing a series of mutually exclusive buttons to select an entry to insert into a database field

## Declaration

Source position: dbctrls.pp line 522

`type TDBRadioGroup = class(TCustomRadioGroup)`
`protected`
`procedure Change; virtual;` |  | Change - calls the OnChange event handler if it is assigned
`procedure Notification(); override;` |  |
`procedure DataChange();` |  | DataChange - updates the current Value to reflect a change inthe data
`procedure UpdateData();` |  | UpdateData - places the current Value into the data
`property DataLink: TFieldDataLink; [r]` |  | DataLink - the field data link to be used for the data
`function GetButtonValue();` |  | GetButtonValue - returns the string value of the button associated with the specified index
`procedure UpdateRadioButtonStates; override;` |  | UpdateRadioButtonStates - performs the inheited method and ensures that any updates are also reflected via the data link, if it is active and in an Editing state
`procedure Loaded; override;` |  |
`public`
`constructor Create(); override;` |  | Create - constructor for TDBRadioGroup: calls inherited Create then forms datalinks and actions
`destructor Destroy; override;` |  | Destroy - destructor for TDBRadioGroup: frees links and items, then calls inherited Destroy
`procedure EditingDone; override;` |  | EditingDone - updates the record through the datalink, then calls inherited EditingDone
`property Field: TField; [r]` |  | The DataSet Field relevant to the data being selected
`property ItemIndex;` |  | The Index value in the list of Items (a stringlist with the names of the selections for radio buttons)
`property Value: String; [rw]` |  | The selected value (as indicated by ItemIndex)
`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 BorderSpacing;` |  | Determines the border spacing for this control
`property Caption;` |  | Caption - the text-string appearing on the Control, usually used to identify its function
`property Columns;` |  | Columns - the number of columns in which the Items (radio buttons) are to be arranges
`property DataField: String; [rw]` |  | The name (as a string) of the Field whose data are linked to the control
`property DataSource: TDataSource; [rw]` |  | The DataSource from which relevant Field data are to be linked - usually the result of a database query
`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 Items; [w]` |  | Items - a string list containing the captions for the radio boxes
`property OnChange: TNotifyEvent; [rw]` |  | Event Handler for any change in the radiogroup selection
`property OnChangeBounds;` |  | Event handler for a change in bounds of the control
`property OnClick;` |  | Event Handler for mouse 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 OnMouseDown;` |  | Event handler for when a mouse button is pressed down
`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 ReadOnly: Boolean; [rw]` |  | ReadOnly - if True, data can only be read, not written or modified. (Doesn't really make sense for a RadioGroup!)
`property TabOrder;` |  | The place this control occupies in the list of tabs
`property TabStop;`
`property Values: TStrings; [rw]` |  | The values of the strings in Items
`property Visible;` |  | Visible - can the control be seen?
`end;`

## Inheritance

`TDBRadioGroup` |  | TDBRadioGroup - a data-aware version of TRadioGroup, providing a series of mutually exclusive buttons to select an entry to insert into a database field
`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

The properties of TDBRadioGroup are similar to those of TRadioGroup (and TCustomRadioGroup). Access is obtained to members of the group by selecting (in the Object Inspector) the ellipsis (...) next to the entry Items, and then editing the stringlist.

At runtime, selecting one of the radiobuttons makes the corresponding ItemIndex available to the programmer, and the corresponding string Item gets selected and appears as the string value for the record in that field.

## See also

HowToUseDataAwareControls |  | HowToUseDataAwareControls - Hints for accessing databases

The latest version of this document can be found at lazarus-ccr.sourceforge.net .