-
June 28th, 2007, 09:04 #1
findWindow() syntax to find a panel?
Trying to figure out how to to locate the windowinstance for a panel using the Interface.findWindow function.
Have a panel like so:
Code:<panel name="shortcuts" modes="host"> <class>shortcuts_dm</class> <bounds> <anchored> <left> <anchor>left</anchor> <offset>370</offset> </left> <top> <anchor>top</anchor> <offset>90</offset> </top> <bottom> <anchor>bottom</anchor> <offset>30</offset> </bottom> <size> <width>67</width> </size> </anchored> </bounds> </panel>
Code:<windowclass name="shortcuts_dm"> <sizelimits> <maximum> <height>1000</height> </maximum> </sizelimits> <sheetdata> <windowreferencecontrol> <icon> <normal>DesktopIconCharacters</normal> <pressed>DesktopIconCharactersDown</pressed> </icon> <bounds>20,0,47,27</bounds> <class>charactersheetlist</class> <recordname>charsheet</recordname> <tooltip> <text>Characters</text> </tooltip> <nodrag /> <closetoggle /> </windowreferencecontrol> ... </windowclass>
I though this would work since the panel class has no database node but it just gives an "invalid parameters passed to findWindow" error:
Code:Interface.findWindow("shortcuts_dm"), nil);
Code:Interface.findWindow("shortcuts_dm"), "");
Code:Interface.findWindow("shortcuts_dm"), "nil");
Anyone know how to do this?Work Less, Game More!
-
June 28th, 2007, 13:57 #2
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 #3
Cheers Joshua.
Will triple-check my code. Probably some silly mistake like an incorrect uppercase/lowercase character...Work Less, Game More!
-
September 13th, 2007, 23:13 #4
Bump. I still can't figure out how to use findWindow to find a panel.
e.g. trying to find the chat window:
Code:if Interface.findWindow("chat", "") then print("found chat"); else print("couldnt find chat"); end
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.Work Less, Game More!
-
September 14th, 2007, 10:43 #5
Aha! Now I see your sneaky bit of coding! And I shall make like a and 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!Work Less, Game More!
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks