In a FireMonkey mobile app (just running on Android for now), I am calling a REST endpoint. I want to show the wait indicator first, call the endpoint and then hide the wait indicator. The following code all works correctly, but the wait indicator never shows.
Any ideas what I need to do?
Cheers,
Paul
procedure TfrmLogin.bLoginClick(Sender: TObject);
begin
//send user name and password to server for verification
frmMain.waitIndicator.Visible := True;
frmMain.waitIndicator.Active := True;
try
myRestClient.BaseURL := gblURL;
myRestRequest.Params.Clear;
myRestRequest.Params.AddItem('', '{"pUser": "' + eUsername.Text + '", "pPassword": "' + ePassword.Text + '"}', pkREQUESTBODY, [], 'application/json');
myRestRequest.Execute;
//if it's ok, login and go to first page
if myRestResponse.StatusCode = 200 then begin
ParseLoginJSON(myRestResponse.Content);
fMain.mvDrawer.MasterButton := fMain.MasterButton;
fMain.MasterButton.Visible := True;
fMain.lEmployee.Text := gblLogin.STAFF_FIRST + ' ' + gblLogin.STAFF_SURNAME;
fMain.mbNewWorksheetClick(Self);
end else begin
TDialogService.ShowMessage('There was an error logging in. Please try again.' + #13#10 + 'Status: ' + IntToStr(myRestResponse.StatusCode));
end;
finally
frmMain.waitIndicator.Visible := False;
frmMain.waitIndicator.Active := False;
end;
end;