Querying the model panel...?

Hey all, I want to write a mel script that will just turn off and on xray shaded mode in whatever view I am in. It works fine for turining it on and off but How do I query the name of the window. I looked in the script editor and when I turned on xray mode it had a name like modelView4 in its last field, So how do I return the modelView I am currently in. Thanks for any help....

"-wf" flag of "getPanel" command will show you the panel that currently has focus.

In case with me, I usually use it as follows...
{
string $curPanel = getPanel -wf;
if(modelEditor -q -xray $curPanel)modelEditor -e -xray 0 $curPanel;
else modelEditor -e -xray 1 $curPanel;
}

*Maya 4.5 NT ~takigawa

Hey,

How do you query the model of a window that does not have focus?