//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "ComboBox.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
	: TForm(Owner)
{
}
//---------------------------------------------------------------------------

// BeginExample: ComboBox
// Class: StdCtrls.TComboBox
// Method: StdCtrls.TCustomCombo.AddItem
// Property: Controls.TCustomListControl.ItemIndex
// Property: StdCtrls.TCustomComboBox.AutoComplete

// BeginCode
/*
This is a very simple example showing how to create a comboBox, add to
it some choices, selecting a default value and getting the selected
value.
*/
void __fastcall TForm1::FormCreate(TObject *Sender)
{
//comboBox initialize
comb = new TComboBox(this);
comb->Parent = this;

//visual options
comb->Align = TAlign::alLeft;
comb->DoubleBuffered = true;
comb->AutoComplete = true;

//adding items to the combo box
comb->AddItem("firstChoice",NULL);
comb->AddItem("secondChoice",NULL);
comb->AddItem("thirdChoice",NULL);

//setting the default value
comb->ItemIndex = 1;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
MessageDlg("Selected text: " + comb->Text,
			mtInformation, TMsgDlgButtons() << mbOK, 0);
}
// EndCode
// EndExample: ComboBox
//---------------------------------------------------------------------------
