yellowbusbon
Programmer
My program creates Frames inside a scrollbox at runtime.
The Created Frames has a button to delete itself.
After the button is clicked and the frame is delete, an error will occur randomly sometimes.
The Code that create and delete frame is like this:
void __fastcall TMainForm::BtnCreateClick(TObject *Sender){
TMyChildForm *MCF = new TMyChildForm(NULL);
MCF->Parent = this->ScrollBox1;
}
void __fastcall TMyChildForm::BtnDeleteClick(TOject *Sender){
delete(this);
}
I guess the problem is because VCL still got something to do with the Child Frame which delete itself in the button handler. How can I avoid this?
Thanks
The Created Frames has a button to delete itself.
After the button is clicked and the frame is delete, an error will occur randomly sometimes.
The Code that create and delete frame is like this:
void __fastcall TMainForm::BtnCreateClick(TObject *Sender){
TMyChildForm *MCF = new TMyChildForm(NULL);
MCF->Parent = this->ScrollBox1;
}
void __fastcall TMyChildForm::BtnDeleteClick(TOject *Sender){
delete(this);
}
I guess the problem is because VCL still got something to do with the Child Frame which delete itself in the button handler. How can I avoid this?
Thanks