Eric H. Jung wrote:
Hi,

I asked this question here
http://forums.mozillazine.org/viewtopic.php?t=373278 but that didn't
help...

I'm using this code to focus/activate/bring-to-top both <window/> and
<dialog/> elements:

Components.classes["@mozilla.org/appshell/window-mediator;1"]
  .getService(Components.interfaces.nsIWindowMediator)
  .getMostRecentWindow("passwordmaker")
  .focus();

It works if getMostRecentWindow() returns a <window/>, but if it
returns a modal <dialog/>, I get this exception:

"Component returned failure code: 0x80004005 (NS_ERROR_FAILURE)
[nsIDOMWindowInternal.focus]"  nsresult: "0x80004005

I'm using windowtype="passwordmaker" as a dialog attribute. Anyone know
what I'm doing wrong?

Eric, I use this since 2003 and it still works:

  openTabManager: function()
  {
    /***
* Do a reverse lookup, otherwise we will always end up with 'multizilla:tabmanager' * Note: keep the ID's of tmIDs[] in sync with the XUL files for the windows!
      */
var tmIDs = [ "multizilla:tm-properties", "multizilla:tm-preferences", "multizilla:tabmanager" ];

    for (i in tmIDs) {
      var dialogWin = getMostRecentWindow(tmIDs[i], false);

      if (dialogWin) {
        dialogWin.focus();
        break;
      }
      else {
        if (i == tmIDs.length-1) {

window.openDialog("chrome://multiviews/content/tab-manager/tabManager.xul", "", "chrome, alwaysRaised, dialog, minimizable, resizable");
          break;
        }
      }
    }
  },

I hope this helps,
/HJ
_______________________________________________
Project_owners mailing list
[email protected]
http://mozdev.org/mailman/listinfo/project_owners

Reply via email to