TCombobox的AddItem方法参数怎么用的?
我查下资料
C++
virtual __fastcall AddItem(AnsiString Item, TObject * AObject);
第二个参数怎么用,实际作用干什么的,没看明白
用法
//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("1st", (TObject *)111);
comb->AddItem("2nd", (TObject *)222);
comb->AddItem("3th", (TObject *)333);
comb->AddItem("4th", (TObject *)444);
void __fastcall TForm1::ComboBox1Change(TObject *Sender)
{
if (comb->ItemIndex < 0) return;
// 获取ComboBox当前选中项附带的数据
int n = (int)comb->Items->Objects[comb->ItemIndex];
ShowMessage(n);
}