c++ builder:从 TFramedVertScrollBox 中动态删除所有 TPanel
c++ builder: dynamically remove all TPanel's from TFramedVertScrollBox
在我的 C++ Builder 项目中,我有一个动态获取 TPanel 的 TFramedVertScrollBox (pnl_art_box)。我想在添加 "new" 之前清除所有现有的 TPanel。
for(int i = 0; i < this->pnl_art_box->ComponentCount; i++)
{
// this here is where i dont find any solution ...
this->pnl_art_box->Components[i]->DestroyComponents();
}
for(int i = 0; i < i_article_amount;i++)
{
this->articlelistpanels[i] = new TPanel(this->pnl_art_box);
this->articlelistlabels[i] = new TLabel(this);
this->articlelistlabels[i]->Text = this->articlelist[i].get_name();
this->articlelistpanels[i]->Align = Fmx::Types::TAlignLayout::MostTop;
this->articlelistpanels[i]->AddObject(this->articlelistlabels[i]);
this->pnl_art_box->AddObject(this->articlelistpanels[i]);
}
在 Google 我只找到了很少的帮助,其中 none 是用 C++ 编写的;
如果有人能在我做错时告诉我,那就太好了。
此致 Timo Treichel
终于自己找到了。
正确的命令是:
for(int i = 1; i < this->pnl_art_box->ComponentCount; i++)
{
this->pnl_art_box->Components[i]->DisposeOf();
}
在我的 C++ Builder 项目中,我有一个动态获取 TPanel 的 TFramedVertScrollBox (pnl_art_box)。我想在添加 "new" 之前清除所有现有的 TPanel。
for(int i = 0; i < this->pnl_art_box->ComponentCount; i++)
{
// this here is where i dont find any solution ...
this->pnl_art_box->Components[i]->DestroyComponents();
}
for(int i = 0; i < i_article_amount;i++)
{
this->articlelistpanels[i] = new TPanel(this->pnl_art_box);
this->articlelistlabels[i] = new TLabel(this);
this->articlelistlabels[i]->Text = this->articlelist[i].get_name();
this->articlelistpanels[i]->Align = Fmx::Types::TAlignLayout::MostTop;
this->articlelistpanels[i]->AddObject(this->articlelistlabels[i]);
this->pnl_art_box->AddObject(this->articlelistpanels[i]);
}
在 Google 我只找到了很少的帮助,其中 none 是用 C++ 编写的;
如果有人能在我做错时告诉我,那就太好了。
此致 Timo Treichel
终于自己找到了。 正确的命令是:
for(int i = 1; i < this->pnl_art_box->ComponentCount; i++)
{
this->pnl_art_box->Components[i]->DisposeOf();
}