Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

dialog window timer

Participant ,
Sep 13, 2015 Sep 13, 2015

opened dialogue window close after 10 seconds

Is there a command to do this

TOPICS
Scripting
901
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Engaged , Sep 14, 2015 Sep 14, 2015
function show_ready( msg, msec) {
     var w = new Window("palette");
     w.add("statictext", undefined, msg);
     var now = new Date().getTime();
     var then = new Date().getTime();
     w.show();
     while(now-then < msec) {
          now = new Date().getTime();
     }
     w.close();
 }

Does that help?

Translate
Engaged ,
Sep 14, 2015 Sep 14, 2015
function show_ready( msg, msec) {
     var w = new Window("palette");
     w.add("statictext", undefined, msg);
     var now = new Date().getTime();
     var then = new Date().getTime();
     w.show();
     while(now-then < msec) {
          now = new Date().getTime();
     }
     w.close();
 }

Does that help?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Sep 14, 2015 Sep 14, 2015

Why does not run (I use the dialog window, dont palette)

var w = new Window("dialog");

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Sep 14, 2015 Sep 14, 2015

Yes, that is why it doesn’t work.

A dialog can interact with user events (click of a button) but there are no timer events.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Sep 15, 2015 Sep 15, 2015
LATEST

Anyway if you really need a modal solution (i.e. dialog) you can trigger the timer within the activate event handler:

function show_ready_dial(/*str*/msg,/*uint*/msec,  w,u)

{

    (w=new Window('dialog')).add('statictext',u,msg);

    w.onActivate = function(){ $.sleep(msec); this.close(); };

    w.show();

}

// Test

// ---

show_ready_dial("This should work.",10000);

@+

Marc

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines