Attached is a simple wrapper for the SweetAlert2 library. (QUICK HACK.. No unit testing, no tidy up etc..)
** No warranty - Use at your own risk **
FREE for commercial use, etc.. (just don't remove the copyright header).
1) Compile the Package/Install
2) Make sure your path includes the control folder
3) Copy the files/sweetalert folder into your project
4) Drag/Drop the uniSweetAlert control onto your form.
Simple usage like:
procedure TMainForm.UniButton1Click(Sender: TObject);
begin
UniSweetAlert1.ShowMessage;
// or like
UniSweetAlert1.Error('Oops','Something went wrong');
// or like
UniSweetAlert1.Error('Oops','Error again','FixMe',3000);
// or like
UniSweetAlert1.Question('Is this true','Please click one of the options below:','YES','NO',3000);
// or like
UniSweetAlert1.title := 'Hello';
UniSweetAlert1.text := 'Testing';
UniSweetAlert1.alertType := TAlertType.success;
UniSweetAlert1.ShowMessage;
end;
// Events for Confirm or Cancel/Dismiss
procedure TMainForm.UniSweetAlert1Dismiss(Sender: TObject);
begin
UniButton1.Caption := 'DIS';
uniMemo1.Lines.Add('Dis');
end;
procedure TMainForm.UniSweetAlert1Success(Sender: TObject);
begin
UniButton1.Caption := 'CLICKED';
uniMemo1.Lines.Add('Clicked');
end;
Either (1) set properties and call .ShowMessage;
Or call the Error, Info, etc methods.
Enjoy..
Regards
Andrew
2017-07-29-uniSweetAlert V3.zip