andyhill Posted October 5, 2017 Posted October 5, 2017 I have a UniForm (UniForm2) that I am trying to send an AjaxEvent to update my ProgressBar (pg). The Form's AjaxEvent code is firing on: active, move, resize etc. as expected. It will not fire on my custom EventName 'update' sent via my UpdateJobProgress procedure, please advise how to resolve - thanks in advance. procedure TJobThread.Execute; // This will be extended when the basics work begin Progress:= 0; while not Terminated and (Progress < 100) do begin Inc(Progress); Sleep(50); end; end; function TUniForm2.DoSomething(): Boolean; ... // if Assigned(job) then begin if not (job.Finished or job.Terminated) then begin job.Terminate; end; job.Free; end; // job:= TJobThread.Create; job.FreeOnTerminate:= False; UniSession.AddJS('UniForm2.pg.updateProgress(0.0, ''Running...'', false);'); UpdateJobProgress; ... BUSY WORKING HERE ... end; procedure TUniForm2.AjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings); begin if EventName = 'update' then begin MessageDlg(EventName, mtWarning, [mbOK]); UniSession.AddJS(Format('UniForm2.pg.updateProgress(%d/%d, ''Running...'', true);', [job.Progress, 100])); // if not (job.Finished or job.Terminated) then begin UpdateJobProgress; end else begin if job.Progress = 100 then begin UniSession.AddJS('UniForm2.pg.updateProgress(1.0, ''Done'', true);'); end else begin UniSession.AddJS(Format('UniForm2.pg.updateProgress(%d/%d, ''Stopped by user'', true);', [job.Progress, 100])); end; end; // end; end; procedure TUniForm2.UpdateJobProgress; begin UniSession.AddJS('setTimeout(function() { ajaxRequest(UniForm2.form, ''update'', []) }, 200)'); end; Quote
Sherzod Posted October 5, 2017 Posted October 5, 2017 Hi, Which edition and build are you using ?! http://www.unigui.com/doc/online_help/synch-and-asynch-operations.htm Look at these demo examples: \SyncClientUpdate Best regards, Quote
andyhill Posted October 5, 2017 Author Posted October 5, 2017 FMSoft_uniGUI_Complete_Professional_1.0.0.1410_Trial Quote
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.