to close the dialog after pause

Hi!

I can't understand how to close the dialog after pause  automatically without pressing the buttons.

The task is simple, but... :)

Comments

  • CGI3DMCGI3DM Posts: 279

    wdialog.hide()

  • YudinEdYudinEd Posts: 90
    edited February 2018

    Sorry. But hide() and close() - it's not the same thing.

    I don"t know what condition I can use to exit the dialog and close the script.

    Approximately:

    1) open new DzDialog

    2) If (condition or sleep(2000))  then DzDialog.close() and to terminate script

    3) DzDialog.exec()

    :)

    Post edited by YudinEd on
  • Hi!

    I'll try to explain more clearly using example.

    Everything is simple. In the script opens a window with information.
      After a few seconds, the dialog box closes itself wthout pressing buttons 

  • CGI3DMCGI3DM Posts: 279

    //wDlg.exec()

    wDlg.show ()

    sleep(2000)

     

     

  • jag11jag11 Posts: 885

    Ok then.

     

    (function(){ 	var oStyle = App.getStyle(); 	var wDlg = new DzBasicDialog(); 	var oDlgWgt = wDlg.getWidget();	wDlg.caption = "Auto Closing Dialog"; 	var sKey = wDlg.caption.replace( / /g, "" ) + "Dlg";	oDlgWgt.objectName = sKey; 	var messageLabel = new DzLabel(wDlg);	messageLabel.text = "";	wDlg.addWidget(messageLabel);		var counter = 5000;    var textUpdaterTimer = new DzTimer();    textUpdaterTimer.singleShot = false;    textUpdaterTimer.interval = 500;    connect(textUpdaterTimer, "timeout()", function () { processEvents(); messageLabel.text = "\nThis dialog will self destroy in " + Math.floor(counter/1000); counter -= 500; });    textUpdaterTimer.start();	    var timer = new DzTimer();    timer.singleShot = true;    timer.interval = 5000;    connect(timer, "timeout()", function () { wDlg.close(); });    timer.start();	wDlg.exec();		textUpdaterTimer.stop();})();

     

    2018-02-20.png
    198 x 118 - 4K
  • Cool. Both options are working. Thanks.

    armando_cg25_555c08aa3d , it's the  interesting trick with show() ; sleep(2000)  instead of  exec()

     

Sign In or Register to comment.