BCB : how to iterate over controls on a form?

后端 未结 3 1042
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-17 07:23

I am looking for some BCB code to iterate over the controls on a form and get some information about them.

I tried using myForm->ControlCount and

3条回答
  •  孤城傲影
    2020-12-17 07:51

    This may help you too:

    for (int index = 0; index < ControlCount; index ++)
    {
        if(Controls[index]->InheritsFrom(__classid(TCustomEdit)))
        {
            TCustomEdit *edit = (TEdit*) Controls[index];
            edit->Text = "Ok";
        }
    }
    

提交回复
热议问题