Wicket Posted March 12, 2020 Share Posted March 12, 2020 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? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted March 12, 2020 Share Posted March 12, 2020 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; 1 Quote Link to comment Share on other sites More sharing options...
Wicket Posted March 12, 2020 Author Share Posted March 12, 2020 Hi Sherzod - thanks works like a charm! 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.