I'm trying to write a simple TTask method that creates a TPopup containing a TAniIndicator - so I can show a wait cursor on Android and iOS while background tasks are processing (if someone already has solved this - I'd really like to see the code).
For the Invoke(), I have the following:
void __fastcall Invoke()
{
popup = new TPopup(NULL);
popup->Parent = db->mainForm;
popup->Align=TAlignLayout::Center;
TAniIndicator *ani = new TAniIndicator(popup);
ani->Parent=popup;
ani->Align=TAlignLayout::Contents;
ani->Enabled=true;
popup->PopupModal();
}
This all works as expected when invoked via
cursorTask[0] = TTask::Run(_di_TProc(new TCppCursorTask()));
The problem is, when I cancel the task via
cursorTask[0]->Cancel();
The popup is still visible - because it hasn't been destroyed. I've tried adding a ~TCppCursorTask method as well as a Destroy() method, but they don't get invoked when Cancel is called.