Jump to content

Recommended Posts

Posted

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?

unigui.png

alerts.png

Posted

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.

image.png.d3c28c100e2eaec937fbc71b606c2692.png

Posted

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

Screenshot_5.jpg

Posted
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});');

 

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