11 Replies Latest reply on Dec 6, 2009 6:59 AM by Harbs.

    Persistent ScriptUI Dialogs that can be shown several times.

    G. Singelmann Level 3

      Hi all,


      I love ScriptUI and all its possibilities. But every time I try something new I fail for at least some days


      Here is my newest conundrum: I try to do something that involves selecting a menu item along the road. Assembling all menu items in a tree view takes up to 20 seconds so I would like to build that dialog only once and call it repeatedly from the main dialog.


      The test setup illustrates the problem:



      var w = new Window("dialog");

      var d = new Window("dialog");

      d.closeDlg = d.add("button", undefined, "Close Dialog");

      d.closeDlg.onClick = function () {



      w.openDlg = w.add("button", undefined, "Open Dialog");

      w.cancelElement = w.add("button", undefined, "Cancel");

      w.openDlg.onClick = function () {





      The first click on "Open Dialog" looks as it should. But when you cancel d and click again, the sub dialog contains nothing and is off the screen.
      I can correct the latter (d.center() before d.show() ), but not the former.
      Help says "When a window or container is hidden, its children are also hidden, but when it is shown again, the children retain their own visibility states."
      I tried to show the children in a d.onShow() function but so far with no success.
      So my question is (thank you for reading this far):
      Can this be done? Can I build a complicated dialog once and call it several times from a different dialog?
      The only other option I can think of is to build an ugly super-dialog that contains all the controls of the main and of the sub dialog. bah.
      Thank you