|
안녕하세요?
일전에 컨트롤 검색하는 방법을 질문올려서 잘 사용하고 있었는데요.
또 막히는 부분이 있어서 도움받고자 질문 올립니다..
FindControl() 함수는 폼에 있는 Label을 Tag단위로 검색합니다.
여기까지는 잘 되는데요..
FindControl()을 호출하는 부분에서
Call by Address, Call by Reference 하는 것처럼 여러개의 컨트롤을 넘겨받고 싶은데요..
어떻게 하면 좋을까요??
//---------------------------------------------------------------------------
void __fastcall TForm1::FindControl(TLabel *pLabel1, TLabel *pLabel2)
{
for(int i=0; i<Form1->ComponentCount; i++) {
TLabel *pFind= dynamic_cast<TLabel *>(Form1->Components[i]);
if(pFind) {
if(pFind->Tag==1) {
pLabel1= pFind;
Memo1->Lines->Add(pLabel1->Name);
}
if(pFind->Tag==2) {
pLabel2= pFind;
Memo1->Lines->Add(pLabel2->Name);
}
}
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
TLabel *pLabel1= NULL, *pLabel2= NULL;
FindControl(pLabel1, pLabel2); //<<== 이부분이요~~
//검색한 컨트롤 사용하기
if(pLabel1) {
Memo1->Lines->Add(pLabel1->Caption);
}
if(pLabel2) {
Memo1->Lines->Add(pLabel2->Caption);
}
}
|