N.Marzio Posted April 21, 2020 Posted April 21, 2020 Good morning, I'm continuing to test the various components and today I ran into this error: Blocking method Exceute () could not be called Running the demo project sweeta (UnisweetAlert) works ... What could be the problem? This is the Code: Try FSweat.AlertType: = GetAlertType (FParam.Tipo); FSweat.AllowEscapeKey: = False; FSweat.AllowOutsideClick: = false; FSweat.ShowCloseButton: = False; FSweat.ConfirmButtonText: = FParam.BtnOkTesto; FSweat.ShowConfirmButton: = FParam.BtnOkVisua; FSweat.CancelButtonText: = FParam.BtnCanTesto; FSweat.ShowCancelButton: = FParam.BtnCanVisua; FSweat.ShowLoaderOnConfirm: = FParam.ShowLoader; FSweat.Title: = FParam.Testo; // FSweat.OnConfirm: = cmdConfirm; FSweat.OnDismiss: = cmdAnulla; FSweat.OnPreConfirm: = cmdLoader; // if FParam.InputVisua then begin FSweat.InputType: = ItText; FSweat.InputValue: = FParam.InputValue; end else FSweat.InputType: = ItNone; // // //FSweat.show; <==== It works !! // {} if FSweat.Execute then begin <====== Error !!!! FParam.InputValue: = FSweat.InputResult; FParam.Result: = mrOk; end else begin FParam.InputValue: = ''; FParam.Result: = mrCancel; end; {} finally End; Quote
N.Marzio Posted April 21, 2020 Author Posted April 21, 2020 The cause may be because I'm using the demo version? Tks Quote
Hayri ASLAN Posted April 21, 2020 Posted April 21, 2020 Hi, where you calling execute method? onCreate of form? Quote
N.Marzio Posted April 22, 2020 Author Posted April 22, 2020 The error also occurs with the component it's at designTime on the form. This is the code TMXUniGuiMsgParam = Record Testo : String; ShowLoader : Boolean; BtnOkVisua : Boolean; BtnOkTesto : String; BtnCanVisua : Boolean; BtnCanTesto : string; InputVisua : Boolean; InputValue : string; InputType : TInputType; SleepSecond : Integer; end; procedure TxFrmBase.SweetMessage(var aParam: TMXUniGuiMsgParam); var FSweet : TUniSweetAlert; begin FSweet := TUniSweetAlert.Create(Self); // Actual Form Try FSweet.AlertType := TAlertType.atInfo; FSweet.AllowEscapeKey := False; FSweet.AllowOutsideClick := false; FSweet.ShowCloseButton := False; FSweet.ConfirmButtonText := aParam.BtnOkTesto; FSweet.ShowConfirmButton := aParam.BtnOkVisua; FSweet.CancelButtonText := aParam.BtnCanTesto; FSweet.ShowCancelButton := aParam.BtnCanVisua; FSweet.ShowLoaderOnConfirm:= aParam.ShowLoader; FSweet.Title := aParam.Testo; // if aParam.InputVisua then begin FSweet.InputType := ItText; FSweet.InputValue := aParam.InputValue; end else FSweet.InputType := ItNone; // // // FSweet.show; <=== OK // if FSweet.Execute then begin <<<=============== Error Blocking aParam.InputValue := FSweet.InputResult; aParam.Result := mrOk; end else begin aParam.InputValue := ''; aParam.Result := mrCancel; end; Finally FSweet.Free; End; procedure TxFrmBase.ButtonExecute(Sender : TObject); var lPar : TMXUniGuiMsgParam; begin ...... SweetMessage(lPar); end; Quote
Hayri ASLAN Posted April 23, 2020 Posted April 23, 2020 Is UniMainModule.EnableSynchronousOperations = True? To able to use blocking windows, you must set it true otherwise, you will get error. Quote
N.Marzio Posted April 23, 2020 Author Posted April 23, 2020 UniMainModule.EnableSynchronousOper ations was not active ... Now works! But by activating this switch UniMainModule.EnableSynchronousOper ations: = True what changes on the application, what are the benefits and what could be the limitations? Thank you. Quote
Hayri ASLAN Posted April 23, 2020 Posted April 23, 2020 It affects all modal windows including MessageDlgs and ShowMessages unless you explicitly call the Non-blocking version of those methods. 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.