This shows you the differences between two versions of the page.
— |
developer_center:recipe_book:extensions_and_core:getting_the_main_window [2013/12/28 08:56] (current) geekshadow created |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Getting the Main Window ====== | ||
+ | You've probably created some kind of controller code on the main window for your extension, and you may need access to it from in a media page, from another window, or a display pane. In this case, you'll want to grab the main window like this: | ||
+ | |||
+ | <code> | ||
+ | var wMediator = Components.classes["@mozilla.org/appshell/window-mediator;1"] | ||
+ | .getService(Components.interfaces.nsIWindowMediator); | ||
+ | var mainWindow = wMediator.getMostRecentWindow("Songbird:Main"); | ||
+ | </code> |