CastleSoft Posted August 2, 2017 Posted August 2, 2017 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 3 1 Quote
david600320@hotmail.com Posted August 2, 2017 Posted August 2, 2017 Thanks for shareing !! In my case ( Delphi XE2 ) , Error for being compiled . [DCC Fatal Error] uniExtSweetAlert.dpk(46): E2202 Required package 'RESTComponents' not found Quote
CastleSoft Posted August 2, 2017 Author Posted August 2, 2017 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. Quote
david600320@hotmail.com Posted August 2, 2017 Posted August 2, 2017 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; Quote
CastleSoft Posted August 2, 2017 Author Posted August 2, 2017 Add RTTI To the uses clause.. Will fix the problem.. Quote
CastleSoft Posted August 2, 2017 Author Posted August 2, 2017 Add RTTI To the uses clause.. Will fix the problem.. Quote
david600320@hotmail.com Posted August 2, 2017 Posted August 2, 2017 I have removed REST.JSON,REST.Json.Types only ! RTTI is still remained in uses . thanks , Quote
Freeman35 Posted August 2, 2017 Posted August 2, 2017 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. Quote
CastleSoft Posted August 2, 2017 Author Posted August 2, 2017 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). Quote
CastleSoft Posted August 2, 2017 Author Posted August 2, 2017 Updated SweetAlert2 control (REST) removed, fix Z-Order issue when the alert appears behind the form. Added TEST / DEMO Added a new control wrapper for jToast https://github.com/kamranahmedse/jquery-toast-plugin (uniJToast currently has properties, a simple ShowMessage and events for Before/After Show/Hide.) Enjoy. uniExtensions.zip 1 1 Quote
Freeman35 Posted August 2, 2017 Posted August 2, 2017 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. Quote
luiz rogerio reine Posted August 2, 2017 Posted August 2, 2017 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. Quote
Freeman35 Posted August 2, 2017 Posted August 2, 2017 @CastleSoft I tested toast, Its work and cool. I tested sweetalert with https://daneden.github.io/animate.css/ result is fantastic fontawsome aswel. Thank you Quote
CastleSoft Posted August 3, 2017 Author Posted August 3, 2017 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 1 Quote
david600320@hotmail.com Posted August 3, 2017 Posted August 3, 2017 @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 ! Quote
CastleSoft Posted August 4, 2017 Author Posted August 4, 2017 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). https://goo.gl/bnU2Ab 1 Quote
anasb Posted August 13, 2017 Posted August 13, 2017 Thanks for your beautiful ext. I have this error : Quote
Fábio Matte Posted August 14, 2017 Posted August 14, 2017 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? Quote
Edmar Frazao Posted August 16, 2017 Posted August 16, 2017 Is it possible to change it to work on unigui mobile? Quote
Freeman35 Posted August 18, 2017 Posted August 18, 2017 Try first remove delphi settings files. dcu, dof etc. without dpk,pas,res etc. after then try build dpk file. that error mean can not find unicore bpl in search file. Quote
roneydourados Posted August 31, 2017 Posted August 31, 2017 Tecla esc, mesmo habilitada não funciona!! Quote
david600320@hotmail.com Posted September 16, 2017 Posted September 16, 2017 Hi @CastleSoft !! When I do InputType on SweetAlwert2 like below codes , How can i get the filename from SweetAlert2 ? <button click> UniSweetAlert.inputType := TInputType.fileinput ; UniSweetAlert.ShowMessage ; <OnSussess Event> - How can i get the FileName from SweetAlert2 ? Thanks !! Quote
aurelioleonel Posted December 10, 2017 Posted December 10, 2017 Na versão 1397 esta com esse erro [dcc32 Fatal Error] uniExtensions.dpk(32): E2202 Required package 'uniGUI25Core' not found Quote
aurelioleonel Posted December 11, 2017 Posted December 11, 2017 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 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.