MEL How-To #88

Back · Previous · Next Maya

How do I determine which window -- like the Outliner or MultiLister -- is currently the active window?

The Outliner and MultiLister, and all of the modelling views, are instances of Maya panel types. Tearing off one of these instantiates the panel in a window.

There are two methods available to determine the active panel, including windows if the window contains a torn-off panel.

Method #1: Returns the panel that is currently active:

getPanel -withFocus;
// Result: outlinerPanel1 //

Method #1: Returns the panel under the mouse cursor, regardless of whether it is active:

getPanel -underPointer;
// Result: multiListerPanel1 //

Note that these work for panels but not for windows created with MEL scripts, or with the Script Editor or Attribute Editor/Channel Box.

As demonstrated, they will work for the Outliner and MultiLister.

I don't know of a method that works with non-panels.