Roberto Nicchi Posted May 25, 2021 Share Posted May 25, 2021 I have the exception "ProcessEventQueue(): Worker is not assigned." when the statement "UniSession.Synchronize" is executed in the code below. Is my code wrong ? thanks procedure Tmyframe.create_report; var dest:Tdest_report_frm; begin dest:=Tdest_report_frm.Create(uniGUIApplication.UniApplication); dest.showmodal(procedure(sender:Tcomponent; res:integer) begin if res=mrOk then begin ShowMask('Please wait ...'); UniSession.Synchronize; <--- EXCEPTION HERE try CreateTheReport; finally HideMask; UniSession.Synchronize; end; end; end ); Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted May 26, 2021 Administrators Share Posted May 26, 2021 This error shows that Synchronize() can not be called here for different reasons. You should not use Synchronize to display masks. Simply enable ScreenMask property of the Button which closes the form. Quote Link to comment Share on other sites More sharing options...
Roberto Nicchi Posted May 26, 2021 Author Share Posted May 26, 2021 46 minutes ago, Farshad Mohajeri said: This error shows that Synchronize() can not be called here for different reasons. You should not use Synchronize to display masks. Simply enable ScreenMask property of the Button which closes the form. Ok, thanks. Roberto Quote Link to comment Share on other sites More sharing options...
Roberto Nicchi Posted May 26, 2021 Author Share Posted May 26, 2021 20 minutes ago, Roberto Nicchi said: Ok, thanks. Roberto BUT if in the button that close the form i want a confirmation (see below), again there's the same problem. Is there a workaround for this ? if messagedlg('Confirm ?',mtConfirmation,[mbyes,mbno])=mrYes then begin ShowMask('Please wait ...'); UniSession.Synchronize; modalresult:=mrOk; end; Quote Link to comment Share on other sites More sharing options...
Roberto Nicchi Posted May 31, 2021 Author Share Posted May 31, 2021 Ok, only now i have realized that there's a showmask property in the Tunibutton It works fine BUT, if in the button onclick event a messagedlg method is executed, the mask is not visualized. Is it WAD ? thanks Quote Link to comment Share on other sites More sharing options...
Roberto Nicchi Posted May 31, 2021 Author Share Posted May 31, 2021 10 minutes ago, Roberto Nicchi said: Ok, only now i have realized that there's a showmask property in the Tunibutton It works fine BUT, if in the button onclick event a messagedlg method is executed, the mask is not visualized. Is it WAD ? thanks I was folgorated by an idea. Maybe I have to make the request for confirmation with JS code ? If this is correct could anyone tell me how? Unfortunately my knowledge of JS is zero. Quote Link to comment Share on other sites More sharing options...
Roberto Nicchi Posted May 31, 2021 Author Share Posted May 31, 2021 Ok i have the solution. See below. Let me know if there's another (better/faster) solution. In the button have defined the JS event click (in Extevents) function click(sender, e, eOpts) { if (confirm("Confermation request")==true) ajaxRequest(sender, '_doit', []); } in the button have definied the onajaxevent event if EventName = '_doit' then begin modalresult:=mrOk; end; 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.