jahlxx Posted March 29, 2017 Share Posted March 29, 2017 Hi. When launch a long process taht takes some time, appears the message inthe borwser: Connection Error communication failure Retrying .... This is not real, because the process ends ok, but is extrange for the end user. Any idea about this? Thanks. Quote Link to comment Share on other sites More sharing options...
delagoutte Posted March 29, 2017 Share Posted March 29, 2017 Try to see demo threadtimer for long process and update ui Quote Link to comment Share on other sites More sharing options...
jahlxx Posted April 5, 2017 Author Share Posted April 5, 2017 Ok. I've been testing, but is extrabge for me. I have this: procedure Tlib.rptpdf(rep: tquickrep);var xreport: string; FileName:string;begin try xreport := 'reportname.pdf'; rep.prepare; rep.ExportToFilter(tqrPDFDocumentfiltER.Create(xreport)); UniSession.SendFile(xreport,xreport); except on E : Exception do begin lib.error('error raised, with message : ' + E.Message); end; end;end; And I'd like to do these two lines in a separated thread: rep.prepare; rep.ExportToFilter(tqrPDFDocumentfiltER.Create(xreport)); But I don't know how to do it. I need some help, please. Thanks. Quote Link to comment Share on other sites More sharing options...
jahlxx Posted September 18, 2017 Author Share Posted September 18, 2017 Hi. Based on threadtimer demo, I've what I need. But I have some problems or I don't know how to do some things. Sure due to my ignorance. I've never worked with threads. 1. I generate a report in pdf in background. when finish, I call sendfile, but this sentence don't execute. 2. when I create a thread, any reference to another unit different to the unit where the thread is created, raises an error (the thread is not executed or stops). 3. some variables values, can't be accessed from the thread. Some help? Thanks. Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted September 18, 2017 Administrators Share Posted September 18, 2017 You can not call SendFile in a thread from ThreadTimer. Simply increase value of the Ajaxtimeout parameter. It will solve your problem. Quote Link to comment Share on other sites More sharing options...
jahlxx Posted September 18, 2017 Author Share Posted September 18, 2017 ok. and point 2 and 3? thanks. Enviado desde mi SM-A500FU mediante Tapatalk Quote Link to comment Share on other sites More sharing options...
jahlxx Posted September 19, 2017 Author Share Posted September 19, 2017 Hi. reviewing the unitimer sample, I see this in the code. // *Important *//// Thread Timer event should not call any GUI related code// It runs in a separate thread, so it will fail if you interact with GUI components here Is this the reason of my issue? (points 2 and 3). If yes, how can I solve? In the thread execution, I need to access to values of some uniedits values, in the same form, or in other forms. I don't know how to solve this. Thanks. 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.