Notice

The forum is in read only mode.

  • Page:
  • 1

TOPIC: Updating TMemo contents, calling slow functions

Updating TMemo contents, calling slow functions 7 years 1 month ago #1308

I have an TMemo in my form, which i need to update with some textlines, while calling different unpredictable and slow functions, which collects its information by REST based API's.

When clicking a button, an OnClick event fires, which shall run theese REST based APIs:

MemoResultServer is a TMemo.
...

void __fastcall TTileBlockForm::TestResultServerClick(TObject *Sender)
{
MemoResultServer->Lines->Append("Connecting... (please wait!)");

try{
RESTRequest1->Execute();
}
catch(...)
{
MemoResultServer->Lines->Append("An error occured during testing...");
return;
}

MemoResultServer->Lines->Append("Returned!");

MemoResultServer->Lines->Append("'Winner': "+FDMemTable1->FieldByName("username")->AsString);

}

...

The problem here is that nothing gets written to MemoResultServer Form, until the function is finished. This causes the user to wait not knowing that the RESTRequest->Execute() has started...

Have tried BeginUpate / EndUpdate ( calling EndUpdate in front of the RESTRequest->Execute() line.

MemoResultServer->Paint wont work either and Repaint is protected...

Any suggestions ?

Appmethod v1.15 with update 1.
Android Lollipop device (v5.0.1)
  • Page:
  • 1
Moderators: April Anne