Jump to content

How auto close showmessage dialog after 1 sec...


Recommended Posts

Posted
Hi Ulugbek.
 
Well, for example, you can ...
uses ... uniGUIApplication ...
procedure ExtShowMessage(ATitle, AMessage: string; AMilliseconds: Cardinal);
procedure TMainForm.ExtShowMessage(ATitle, AMessage: string; AMilliseconds: Cardinal);
begin
  UniSession.AddJS('var mb = Ext.MessageBox.show({'+
                  'title:'''+ATitle+''','+
                  'msg: '''+AMessage+''','+
                  'icon: Ext.Msg.QUESTION,'+
                  'buttons: Ext.MessageBox.OK,'+
                  'closable: false,'+
                  'fn:function(btn) {}});'+
                  'setTimeout(function(){'+
                  'mb.close();}, '+IntToStr(AMilliseconds)+');');
end;

Use:

procedure TMainForm.UniButton1Click(Sender: TObject);
begin  
  ExtShowMessage('Save Changes?', 'You are closing a tab that has unsaved changes. Would you like to save your changes?', 1000);
end;
Ext.Msg.INFO;
Ext.Msg.QUESTION;
Ext.Msg.WARNING;
Ext.Msg.ERROR;

http://www.sencha.com/forum/showthread.php?196717-Automatically-closing-MessageBox-Showing-differnt-boxes-based-on-success-error-store

 

http://dev.sencha.com/playpen/docs/output/Ext.MessageBox.html

 

 

Sincerely

 

 

 

  • Upvote 1
Posted

How work some like  as showmessage anonymous callback

like this

ShowMessage('Message-2',
    procedure(Res: Integer)
    begin
      UniMemo1.Lines.Add('Result-1: '+IntToStr(Res));
    end
  );

Posted
Hi Ulugbek!

 

I'm sorry, can you describe in detail what is needed such functionality? That is, the dialog is closed after a certain time and the procedure then can be performed...

 

Sincerely...
Posted

I have treeview when after adding new record from showmodal form

some like

  form.showmodal(

      if res=1 then

      begin

          insert into table valus  

         execute

         tree items.clear

         add

         add child

         fullexpand;               ///this not work if i showmessage use then work

        showmessage ( 'Success Add',procedure

        fullexpand;  // THats work

 

)

 

So I want to automatically close without user action..

 

      end

 

)

Posted
Hi Ulugbek.

 

I don't know why, don't works fullexpand;

Maybe before calling fullexpand, put a 1 second delay

 



sleep(1000); // or a little more


Maybe it's not the best solution, but try ...

 

Best regards...

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