View Full Version : findWindow() syntax to find a panel?

June 28th, 2007, 09:04
Trying to figure out how to to locate the windowinstance for a panel using the Interface.findWindow function.

Have a panel like so:

<panel name="shortcuts" modes="host">

with class definition:

<windowclass name="shortcuts_dm">
<nodrag />
<closetoggle />

I'd like to find that panel in order to disable the windowreferencecontrol but findWindow doesn't seem to be locating it.

I though this would work since the panel class has no database node but it just gives an "invalid parameters passed to findWindow" error:

Interface.findWindow("shortcuts_dm"), nil);

Also tried:

Interface.findWindow("shortcuts_dm"), "");


Interface.findWindow("shortcuts_dm"), "nil");

both of which return nil

Anyone know how to do this?

June 28th, 2007, 13:57
Interface.findWindow("shortcuts_dm", ""); should work. I use this all the time for custom windowclass controls not tied to the DB.

June 28th, 2007, 20:03
Cheers Joshua.
Will triple-check my code. Probably some silly mistake like an incorrect uppercase/lowercase character...

September 13th, 2007, 23:13
Bump. I still can't figure out how to use findWindow to find a panel.

e.g. trying to find the chat window:

if Interface.findWindow("chat", "") then
print("found chat");
print("couldnt find chat");

comes back with "couldnt find chat"...

Works fine for normal windowclasses that are not bound to a datasource but not for classes used for panels. :confused:

September 14th, 2007, 10:43
Aha! Now I see your sneaky bit of :ninja: coding! And I shall make like a :bandit: and :pirate: it for my own nefarious purposes!

Or in english:
The onInit function in chat_chat.lua stores a reference to the chat window (self) within the ChatManager.lua script block. Hence, I can access the chat window from anywhere else by caalling a function I have added to ChatManager.lua! :cool: