Table of Contents
TComboBox
ComboBox is used to select list of texts (i.e. Categories). Gets the item that is currently selected in the combo box. Selected returns the selected item in the combo box as a TListBoxItem instance
1 2 3 4 5 6 7 8 9 |
Combobox1->Items->Clear(); Combobox1->Items->Add("Scientist"); Combobox1->Items->Add("Engineer"); Combobox1->Items->Add("Doctor"); Combobox1->Items->Add("Teacher"); Combobox1->Items->Add("Student"); Combobox1->Items->Add("Other"); |
1 2 3 4 5 6 7 |
void __fastcall TForm1::ComboBox1Change(TObject *Sender) { Label1->Text=ComboBox1->Selected->Text; if(ComboBox1->ItemIndex==1) ShowMessage("Wow you are Engineer! That's Nice"); } |
TCheckBox
CheckBox shows a check box that can be either on (selected) or off (cleared). It is easy to add options to be checked or not. You can easily control the check/uncheck events by using OnChange event as below;
1 2 3 4 5 6 |
void __fastcall TForm1::CheckBox1Change(TObject *Sender) { if(CheckBox1->IsChecked) ShowMessage("You checked"); else ShowMessage("You dont checked"); } |
You can manually set TCheckBox on or off.
1 2 3 |
CheckBox1->IsChecked=true; //or CheckBox1->IsChecked=false; |
TSwitch
Switch shows a on/off button that can be either on or off. It is easy to add options to be ON or OFF. You can easily control the check/uncheck events by using OnChange event as below;
1 2 3 4 |
void __fastcall TForm1::Switch1Change(TObject *Sender) { if(Switch1->IsChecked) ShowMessage("You checked"); else ShowMessage("You dont checked"); } |
You can manually set TSwitch on or off.
1 2 3 4 5 |
Switch1->IsChecked=true; //or Switch1->IsChecked=false; |
TStatusBar
The StatusBar is usually aligned at the bottom of a form, and displays information about an application as it runs. A status bar can display a size grip, so if your form is sizable, there is no need to add a TSizeGrip component as long as you have a status bar already. The status bar can also intercept hints.
1 2 3 4 5 6 7 |
void __fastcall TForm1:OnApplicationHint(TObject* Sender); { Label1->Text = Application->Hint; StatusBar1Hint(Sender); } |
Design. Code. Compile. Deploy.
Start Free Trial
Free C++Builder Community Edition