1. Home
  2. Computing & Technology
  3. Delphi Programming

TRadioButton, TCheckBox - Delphi Usage Examples, Tips and Tricks

Delphi's TCheckBox is a button like control with on / off options. TRadioButton present a set of mutually exclusive choices - only one radio button in a set can be selected at a time. Learn how to use check box and radio button controls in Delphi's VCL.
TListBox with Radio Buttons
When MultiSelect is set to false (default state) a ListBox acts as a TRadioButton list container (similar to TRadioGroup). Here's how to draw a radio button for each of the items in a List Box (meaningful only if MultiSelect is false)
TreeView with Check Boxes and Radio Buttons
Here's how to add check boxes and radio buttons to a TTreeView Delphi component. Give your applications a more professional and smoother look.
How to Access a TRadioButton from a TRadioGroup - Disable, Change Font
Here's how to access a specific radio button either by Index or by Caption. When you "grab" the TRadioButton you can disable it, change its color, etc...
CheckBox inside a DBGrid
Here's how to place a check box into a DBGrid. Create visually more attractive user interfaces for editing boolean fields inside a DBGrid.
Add a Check Box to a Standard Dialog Box
Suppose you have a confirmation dialog of some kind, where the user can select a checkbox displayinfg "Don't show this message again"). When the user closes the dialog - program can store the state of the check box (checked or not checked) in a global variable - the next time you need to display this dialog - you simply don't show it.
Set CheckBox.Checked without the OnClick event
If you programmatically change the Checked property the OnClick event will be fired - even though no user iteraction took place. There are (at least) two ways to programmatically change the checked property of the check box while "disabling" the OnClick event.
Place a TCheckBox inside a TRichEdit
For the following example, create a new form, drop a TRichEdit (RichEdit1) on it and create the checkbox (acb) in the FormCreate() event...
Explore Delphi Programming
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. Delphi Programming
  4. Using VCL Components
  5. TRadioButton, TCheckBox

©2009 About.com, a part of The New York Times Company.

All rights reserved.