I need to temporary remove TFrame's OnExit and OnEnter events, so I'm trying to do following:
declare FEnterHandler and FExit Handler:
private:
// ...
TControl *FParentControl;
(__fastcall *(__closure)(TObject*))(TObject*) FEnterHandler;
(__fastcall *(__closure)(TObject*))(TObject*) FExitHandler;
// ...
and I intended to use them as typed downhere, but compilation failed on declaration.
__fastcall TProgressForm::TProgressForm(TComponent *O, TControl *PC)
: TForm(O), FMapProgressData()
{
FParentControl = PC;
if (FParentControl)
{
TFrame *frame = dynamic_cast<TFrame*>(FParentControl);
if (frame)
{
FEnterHandler = frame->OnEnter;
FExitHandler = frame->OnExit;
frame->OnEnter = 0;
frame->OnExit = 0;
}
FParentControl->Enabled = false;
}
}
//-------------------------------------------------------------------------
__fastcall TProgressForm::~TProgressForm()
{
if (FParentControl)
{
FParentControl->Enabled = true;
TFrame *frame = dynamic_cast<TFrame*>(FParentControl);
if (frame)
{
frame->OnEnter = FEnterHandler;
frame->OnExit = FExitHandler;
}
}
}
What am I doing wrong?