bbm Posted August 26, 2020 Share Posted August 26, 2020 Hi, when is the exception "Blocking method Execute() could not be called." raising after calling the Execute function of an UniSweetAlert? Best regards Quote Link to comment Share on other sites More sharing options...
Sherzod Posted August 26, 2020 Share Posted August 26, 2020 11 minutes ago, bbm said: raising after calling the Execute function of an UniSweetAlert? Hi, Can you please provide more details? Quote Link to comment Share on other sites More sharing options...
bbm Posted August 26, 2020 Author Share Posted August 26, 2020 Hi, I use the following parameters: SweetAlert.AlertType := at_Question; SweetAlert.InputType := aInputType; SweetAlert.Title := 'any title'; SweetAlert.Text := 'any text'; SweetAlert.ConfirmButtonText := 'any text'; SweetAlert.ShowConfirmButton := True; SweetAlert.CancelButtonText := 'any text'; SweetAlert.ShowCancelButton := True; SweetAlert.ShowCloseButton := False; SweetAlert.AllowEscapeKey := True; SweetAlert.ShowLoaderOnConfirm := False; The source is as follows if SweetAlert.Execute then begin ..... any source end; After Execute I get an exception as described. Best regards Quote Link to comment Share on other sites More sharing options...
Sherzod Posted August 26, 2020 Share Posted August 26, 2020 7 minutes ago, bbm said: After Execute I get an exception as described. Quote Link to comment Share on other sites More sharing options...
bbm Posted August 26, 2020 Author Share Posted August 26, 2020 Hi, thank you very much. It wörks now . Best regards Quote Link to comment Share on other sites More sharing options...
Abaksoft Posted August 27, 2020 Share Posted August 27, 2020 SynchronousOperations is not a good practice (see Farshad recomandations for a Fast light Unigui Application = Online Doc). http://www.unigui.com/doc/online_help/synch-and-asynch-operations.htm?zoom_highlightsub=synchronous IMHO UniMainModule.EnableSynchronousOperations was introduced in Unigui only to get a soft learning for new Users comming to the Unigui World (closed to Delphi VCL behaviour). Let it by Default to False and try to work with Showing modal Asynchronous Forms. Same For SweetAlert, try to work with its tree Events : - OnConfirm - OnDisMiss - OnPreConfirm Try this simple example OnConfirm Events Regards. SweetAlert_Easy.7z Quote Link to comment Share on other sites More sharing options...
bbm Posted August 27, 2020 Author Share Posted August 27, 2020 Hi, thank you for the information! Best regards Quote Link to comment Share on other sites More sharing options...
azago Posted August 27, 2020 Share Posted August 27, 2020 SynchronousOperations is not a good practice I agree but esiet a problem when we have to use long processes and signal the user to wait via hourglass ... When I have a long query or I have to download a file I have to report to the user the inability to act otherwise he thinks it is the locked system Angelo Quote Link to comment Share on other sites More sharing options...
Abaksoft Posted August 27, 2020 Share Posted August 27, 2020 1 hour ago, azago said: ...otherwise he thinks it is the locked system. Ok, but in these cases there are other solutions. I will try to post this week end. Quote Link to comment Share on other sites More sharing options...
Abaksoft Posted August 28, 2020 Share Posted August 28, 2020 18 hours ago, azago said: SynchronousOperations is not a good practice Hello Angelo, A good practice is to think in "atomic independent elements" : An Unigui Project should not have One Project, but many sub projects. In case of background tasks as : Sending / downloading Files, sending email, SMS, ... Sub Unigui projects as Services is good way. These services are listening flags from a Table. This is what i have done for sending SMS to many customers (a background Task as Service) wich work nicely alone and have the benefit to not freeze the system. Best Regards. Quote Link to comment Share on other sites More sharing options...
asapltda Posted February 14, 2021 Share Posted February 14, 2021 On 8/28/2020 at 5:05 AM, Abaksoft said: Hello Angelo, A good practice is to think in "atomic independent elements" : An Unigui Project should not have One Project, but many sub projects. In case of background tasks as : Sending / downloading Files, sending email, SMS, ... Sub Unigui projects as Services is good way. These services are listening flags from a Table. This is what i have done for sending SMS to many customers (a background Task as Service) wich work nicely alone and have the benefit to not freeze the system. Best Regards. Good afternoon, the model to send messages is very interesting, could you detail how it does ? Thank you Quote Link to comment Share on other sites More sharing options...
x11 Posted February 17, 2021 Share Posted February 17, 2021 On 8/26/2020 at 1:56 PM, bbm said: if SweetAlert.Execute then use UniSweetAlert.Show(Text), but it is a non blocking method procedure TXXX.ShowSweetAlert(const Title, Text: String; MsgDlgType: TMsgDlgType; hideAfter: integer); Var UniSweetAlert: TUniSweetAlert; begin UniSweetAlert := TuniSweetAlert.Create(fParentForm); try uniSweetAlert.InputType := ItNone; UniSweetAlert.ShowCancelButton := False; UniSweetAlert.Animation := not UniMainModule.UserParams.AnimationOff; UniSweetAlert.TimerMS := hideAfter; case MsgDlgType of mtWarning : uniSweetAlert.AlertType := atWarning; mtConfirmation: uniSweetAlert.AlertType := atQuestion; mtError : uniSweetAlert.AlertType := atError; mtInformation : uniSweetAlert.AlertType := atSuccess; else uniSweetAlert.AlertType := atInfo; end; UniSweetAlert.Title := Title; UniSweetAlert.Show(Text); finally UniSweetAlert.free; end; end; 1 Quote Link to comment Share on other sites More sharing options...
x11 Posted February 17, 2021 Share Posted February 17, 2021 On 8/26/2020 at 1:56 PM, bbm said: if SweetAlert.Execute then use MessageDlg() with CallBack: TUniDialogCallBackAnonProc; MessageDlg(const Msg: string; DlgType: TMsgDlgType; Buttons: TMsgDlgButtons; CallBack: TUniDialogCallBackAnonProc); 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.