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

dialog window timer

Participant ,
Sep 13, 2015 Sep 13, 2015

Copy link to clipboard

Copied

opened dialogue window close after 10 seconds

Is there a command to do this

TOPICS
Scripting

Views

722

Translate

Translate

Report

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?

Votes

Translate

Translate
Engaged ,
Sep 14, 2015 Sep 14, 2015

Copy link to clipboard

Copied

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?

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

var w = new Window("dialog");

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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