Jump to content

SweetAlert.Execute


bbm

Recommended Posts

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

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 5 months later...
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

Link to comment
Share on other sites

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;

 

  • Upvote 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...