Jump to content

How to customize Ext.toast


Mehmet Emin

Recommended Posts

On 7/14/2020 at 6:41 PM, Mehmet Emin said:

How can I customize the message of Ext.toast to display as in this picture?

   UniSession.AddJS(
     'Ext.toast({'+
     '   message: "Hai cancellato il tuo sappuntamento.<span onclick=\"alert(''Undo'')\" style=\"color: #81A8E7; font-weight: bold\"> Undo </span>'+
     '             <i onclick=\"Ext.toast().hide(); alert(''Close'')\" style=\"padding-top: 0\" class=\"fa fa-times\" aria-hidden=\"true\"></i>",'+
     '   timeout: 50000'+
     '})'
   );

 

  • Like 5
Link to comment
Share on other sites

  • 2 years later...

sorry , form the link you post , i dont find how to close the toast message with the button on toast message,

i want when click the close button , the toast message is close/hide/disapear 

image.png.f63dd4d5e0c1c8c08797e016c658d81a.png

 

 

here is my procedure 

 

Quote

class procedure PlayWIthMessage.SHOW_TOAST(act: integer; amsg: string);
var acol,apesan,img:String;

begin
case act of
 0:acol:='red';
 1:acol:='#3D7A00';
 2:acol:='yellow';

end;

 amsg:= StringReplace(amsg, #13#10, '<br>', [rfReplaceAll]);


    apesan := apesan+'<table style=margin-top:-18px ><td><i class=\"fa fa-info\" aria-hidden=\"true\">   </i>     &nbsp;&nbsp;&nbsp; </td>&nbsp;&nbsp;<td>'+amsg +'</td></table><span style=\"float:right;margin-top:-18px\"><i  onclick=\"Ext.toast().hide();\"   class=\"fa fa-times\" aria-hidden=\"true\"></i></span>';
    UniSession.AddJS('Ext.toast ({html: "<font color=white style=font-size:15px;font-family:segoe ui;>' + apesan +
 '</font>", align: "br" ,header: false, width:400, autoCloseDelay: 150000, hideDuration: 150000, modal: false, bodyStyle:{"background-color":"'+acol+' !important;box-shadow:'+acol+' !important; border-color: 0px solid transparent;padding:0px 0px 0px 0px !important;top:180px !important"} });');


      end;
 

 

Link to comment
Share on other sites

On 3/6/2023 at 1:44 PM, donlego said:

i want when click the close button , the toast message is close/hide/disapear 

image.png.f63dd4d5e0c1c8c08797e016c658d81a.png

For example:

procedure TMainForm.UniButton1Click(Sender: TObject);
var
  acol,
  apesan,
  amsg: string;
  genMsgID: string;
begin

  amsg := 'Hello';
  acol:='#3D7A00';
  genMsgID := FormatDateTime('yyyymmddhhnnsszzz', Now());

  apesan := apesan+'<table style=margin-top:-18px ><td><i class=\"fa fa-info\" aria-hidden=\"true\">   </i>     &nbsp;&nbsp;&nbsp; </td>&nbsp;&nbsp;<td>'+amsg +'</td></table><span style=\"float:right;margin-top:-18px\"><i  onclick=\"window._msg'+ genMsgID +'.destroy();\"   class=\"fa fa-times\" aria-hidden=\"true\"></i></span>';

  UniSession.AddJS('window._msg'+ genMsgID +' = Ext.toast ({html: "<font color=white style=font-size:15px;font-family:segoe ui;>' + apesan +
   '</font>", align: "br" ,header: false, width:400, autoCloseDelay: 150000, hideDuration: 150000, modal: false, bodyStyle:{"background-color":"'+acol+' !important;box-shadow:'+acol+' !important; border-color: 0px solid transparent;padding:0px 0px 0px 0px !important;top:180px !important"} });');

end;

 

Link to comment
Share on other sites

7 minutes ago, Sherzod said:

For example:

procedure TMainForm.UniButton1Click(Sender: TObject);
var
  acol,
  apesan,
  amsg: string;
  genMsgID: string;
begin

  amsg := 'Hello';
  acol:='#3D7A00';
  genMsgID := FormatDateTime('yyyymmddhhnnsszzz', Now());

  apesan := apesan+'<table style=margin-top:-18px ><td><i class=\"fa fa-info\" aria-hidden=\"true\">   </i>     &nbsp;&nbsp;&nbsp; </td>&nbsp;&nbsp;<td>'+amsg +'</td></table><span style=\"float:right;margin-top:-18px\"><i  onclick=\"window._msg'+ genMsgID +'.destroy();\"   class=\"fa fa-times\" aria-hidden=\"true\"></i></span>';

  UniSession.AddJS('window._msg'+ genMsgID +' = Ext.toast ({html: "<font color=white style=font-size:15px;font-family:segoe ui;>' + apesan +
   '</font>", align: "br" ,header: false, width:400, autoCloseDelay: 150000, hideDuration: 150000, modal: false, bodyStyle:{"background-color":"'+acol+' !important;box-shadow:'+acol+' !important; border-color: 0px solid transparent;padding:0px 0px 0px 0px !important;top:180px !important"} });');

end;

 

it's work thanks very much ,

how with the align position , is there any solution for align:r

right center position

 

Link to comment
Share on other sites

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