Jump to content

UniFileUpload OnCompleted


Wicket

Recommended Posts

Hi All,

I am using UniFileUpload to upload a spreadsheet xlsx - which works great.

However, I have an issue with what comes next. I do some heavy database import work, to take contents of the spreadsheet and import them into relevant tables. I do this work in the OnCompleted event of UniFileUpload - this can take anywhere from 20 seconds to 1 minute or so.

During this time I want to show the user that the process is still working away - currently it just shows the UniFileUpload dialog. This is not acceptable for the user as it looks like the program has hung.

I have tried adding a loading ScreenMask in many ways (trying to Synchronize, adding a mask to the form etc) - but I just can not get it to work/show ontop of the upload form. I have EnableSynchronousOperations := True if that makes a difference.

Not being able to show some sort of progress/Screen mask in this situation is causing me several issues with users, not to mention the bad user experience this brings.

Has anyone got a solution to this?

 

Link to comment
Share on other sites

26 minutes ago, Wicket said:

I do some heavy database import work, to take contents of the spreadsheet and import them into relevant tables. I do this work in the OnCompleted event of UniFileUpload - this can take anywhere from 20 seconds to 1 minute or so.

Hi,

I think you should do this in another event ... for example using UniTimer.

procedure TMainForm.UniFileUpload1Completed(Sender: TObject; AStream: TFileStream);
begin
  ...
  UniTimer1.Enabled := True;
end;
procedure TMainForm.UniTimer1Timer(Sender: TObject);
begin
  (Sender as TUniTimer).Enabled := False;
  try
    ShowMask('Wait...');
    UniSession.Synchronize();
    
    // main code that takes some time...
    
    HideMask;
  except
    //
  end;
end;

 

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...