Jump to content

Recommended Posts

Posted

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

post-14-0-33457200-1501639154_thumb.png

post-14-0-83284700-1501639167_thumb.png

post-14-0-41627600-1501639177_thumb.png

post-14-0-77223100-1501639190_thumb.png

post-14-0-60900300-1501639209_thumb.png

post-14-0-64863000-1501639219_thumb.png

  • Like 3
  • Upvote 1
Posted

RESTComponents can be removed. Originally I planned on using the TJSon.OjectToJson method.. But removed the code and went simple strings instead.
So it shouldn't be needed.

Posted

Thanks for you .

 

After I removed RESTComponent , Error 

 

Uses 

......

 

REST.JSON,REST.Json.Types ,    <-- removed 

 

I removed it ( REST.JSON,REST.Json.Types , )  

 

compiled again , but Error 

 

function TUniSweetAlert.GetAlertType(a: TAlertType): string;

begin
   result := TRttiEnumerationType.GetName(a);             <--- Error !!
 
end;
Posted

Castle soft,

I was lookfor how to use sweetalert. Thank you.

need to work on it, For example, I'll tested it,

UniSweetAlert1.Error('Oops','Something went wrong');   this box allways behind my form.

on my loginform, same, behind my loginform, and its just paint whitebox I can't see in.

js & css files hasto under "files" folder, need copy there.

Just myidea. This usage can be a unit. Not have to component, so can use with callback procedure for dissmis or Success events. And need to wich button clicked on thats events. For example, cancel and no buttons is diffrent.

Best regards.

Posted

To fix the Floating behind the Login form you could add the following to the ServerModule.CustomCSS

 

.swal2-container { z-index:20000; }

 

OR..

 

The next post has an updated version (new files/sweetalert with the extra css). + a new jQuery Toast control + DEMO / Test (c:\tmp was the original folder containing the files).

Posted

To fix the Floating behind the Login form you could add the following to the ServerModule.CustomCSS

 

.swal2-container { z-index:20000; }

Thank you, This solution fixed my problem.

I'll test toast example soon

regards.

Posted

Hi. I'm trying to install these components on Delphi XE8 and got the error on the UniGUI unit seCSSParser.pas that says the unit Dialogs is missing.

Is there a way to install it on this version? (it looks like you use version 10.2 Tokyo). 

Thanks.

Posted

A few more fixes.

 

- Z-Index for jToast fixed

- buttonsStyling (typo / spelling incorrect in SweetAlert2)

 

New css file added to jToast.  (re-grab the files/jtoast and   files/sweetalert folders in any code you use for the updated).

 

Added 'custom' to  jToast..  when 'Pos: custom' the Left and Top are used for positioning.

 

*** If you are using an older version you may need to ignore the buttonStyling missing error and toggle the 'buttonsStyling' and save to fix.

*** If you have Z-Index issues.. Clear your browser cache and try again.

 

Enjoy.

uniExtensions-V5.zip

  • Like 1
Posted

@CastleSoft .

 

In XE2 , still got Same Error !   ( result := TRttiEnumerationType.GetName(a);             <--- Error !!   

 

To install and test your nice component , I edited some lines of code .

 ex )  result :=  'anyString'  ;    // each one of  arrays 

 

Now , it works , Cooool !! 

 

Many thanks !

Posted

A few minor tweaks and another another freebie.

 

iTyped  - https://github.com/luisvinicius167/ityped

 

Simply add the uniTyped control (resize to your size).

 

var s: TStrings;
begin
  s := TStringList.Create;
  s.Add('Welcome to the jungle');
  s.Add('Restarting soo...');
  UniTyped1.text := s;
  UniTyped1.PlayTyped;
  s.Free;
end;
 
or 
 
Just set the properties in the control and do a UniTyped.PlayTyped.
 
Source code and Example below (includes the sweetalert/jquerytoast/iTyped).
 
 
 
 
 
 
 
  • Upvote 1
  • 2 weeks later...
Posted
When I implemented SweetAlert2 to display a message, the message is opening behind the MainForm form and not where I want it.

I have already added the files / * in the indicated places and everything, but the message still appears behind the MainForm.

 

And I did exactly as in DEMO.

 

How could I solve this?

  • 2 weeks later...
  • 3 weeks later...
  • 2 months later...
Posted

Na versão 1397 esta com esse erro [dcc32 Fatal Error] uniExtensions.dpk(32): E2202 Required package 'uniGUI25Core' not found

Resolvido galera, é só remover do projeto o arquivos que tem 25, quando for compilar o próprio delphi vai surgerir colocar os arquivos de acordo com sua versão do unigui, abraços galera

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...