diegojmap Posted May 29, 2020 Posted May 29, 2020 In VCL I use the JvDesktopAlert component, as shown in the image. Clicking trigger a delphi event. I am trying to use the ShowToast command. In Unigui I'm trying to use like this UniSession.AddJS ('Ext.toast ({html: "<b> There is an alert ... </b>", header: false, autoCloseDelay: 5000, hideDuration: 500, modal: false, align: "br", width: 500}); '); And the message below. Would it be possible to get the OnClick alert? Quote
Sherzod Posted May 29, 2020 Posted May 29, 2020 13 minutes ago, diegojmap said: Would it be possible to get the OnClick alert? Can you please explain in more detail? Quote
diegojmap Posted May 29, 2020 Author Posted May 29, 2020 I click on the alert and view a report or screen. I would like to trigger the onclick event or put a button inside Toast. The most I got was to put a link. UniSession.AddJS('Ext.toast({html: ''XX...<a class="btn btn-primary btn-sm" href="https://www.terra.com.br/" target="_blank">link</a> '',header: false, autoCloseDelay: 5000,hideDuration: 500, modal: false, align: "br", width: 500});'); So I need to fire an AjaxEvent to get back to delphi. Quote
diegojmap Posted May 29, 2020 Author Posted May 29, 2020 I almost did it, I'm attaching the example. We just need to get ajaxevent in delphi. It is possible in this case the event "Sucess". TesteCaseAlert.rar Quote
x11 Posted May 29, 2020 Posted May 29, 2020 i am using uniExtensions procedure TMessages.ShowToast(const Title, Text: String; MsgDlgType: TMsgDlgType; hideAfter: integer); Var UniJToast: TUniJToast; begin UniJToast := TUniJToast.Create(fParentForm); try case MsgDlgType of //TIconType = (none, success, error, warning, info); mtWarning : UniJToast.icon := TIconType.warning; mtConfirmation: UniJToast.icon := TIconType.success; mtError : UniJToast.icon := TIconType.error; mtInformation : UniJToast.icon := TIconType.info; else UniJToast.icon := TIconType.success; end;//case UniJToast.pos := TPosition.mid_center; UniJToast.allowToastClose := True; UniJToast.hideAfter := hideAfter; UniJToast.heading := Title; UniJToast.text := Text; UniJToast.ShowMessage; finally UniJToast.Free; end; end; uniSweetAlert.zip Quote
Sherzod Posted May 30, 2020 Posted May 30, 2020 17 hours ago, diegojmap said: I almost did it, I'm attaching the example. We just need to get ajaxevent in delphi. It is possible in this case the event "Sucess". TesteCaseAlert.rar Hello, In your case: UniSession.AddJS('Ext.toast({html: ''<button onclick="ajaxRequest('+ MainForm.WebForm.JSName+', \''Sucess\'', [])">Submit</button>'',header: false, autoCloseDelay: 5000, hideDuration: 500, modal: false, align: "br", width: 500});'); 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.