-
May 16th, 2014, 10:23 #1
Help With Accessing Controls On Other (Peer) Subwindows
Hi Guys,
Yeah, I'm at that stage again - been coding all day and now I'm tired and beating my head against my favourite brick wall again.
I've got a windowreferencecontrol (wrc01) sitting on a subwindow (sw01) and I need to perform a getWindows() call (wrc01.getWindows()) from a second subwindow (sw02). Both subwindows are children of the same parent window (main).
I've got my call as follow:
Code:for kKey,oWindow in pairs(parentcontrol.window.sw01.subwindow.wrc01.getWindows()) do {stuff happeneds}; end
Code:Script Error: [string "sw02_script.lua"]:73: attempt to index field 'subwindow' (a nil value)
ThanksDulux-Oz
√(-1) 2^3 Σ Π
...And it was Delicious!
Alpha-Geek
ICT Professional
GMing Since 1982
NSW, Australia, UTC +10
LinkedIn Profile: www.linkedin.com/in/mjblack
Watch our games on Twitch: www.twitch.tv/dulux_oz
Support Me on Patreon: www.patreon.com/duluxoz
Past Games, etc, on my YouTube Channel: www.youtube.com/c/duluxoz
-
May 16th, 2014, 17:06 #2
Firstly, getWindows() will not work on a windowreferencecontrol, it is usually used with windowlist controls.
In reference to the subwindow being nil, I recommend that you step through your control hierarchy and make sure that you are where you think you are with the code you're using. For debugging your control hierarchy I recommend taking it one step at a time and output the control name/class name to the console. This should, with just a couple of Debug.console commands, give you an idea if you are accessing controls you think you are.
For example:
Code:Debug.console("parentcontrol = " .. parentcontrol.getName()); Debug.console("parentcontrol.window = " .. parentcontrol.window.getClass()); Debug.console("parentcontrol.window.sw01 = " .. parentcontrol.window.sw01.getName());
Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!
-
May 16th, 2014, 18:14 #3
Sorry, typo in my post (told you I was tired).
Post should read <corrected post>:
I've got a windowinstance (wi01) sitting on a subwindow (sw01) and I need to perform a getWindows() call (wrc01.getWindows()) from a second subwindow (sw02). Both subwindows are children of the same parent window (main).
I've got my call as follow:
Code:for kKey,oWindow in pairs(parentcontrol.window.sw01.subwindow.wi01.getWindows()) do {stuff happens}; end
Code:Script Error: [string "sw02_script.lua"]:73: attempt to index field 'subwindow' (a nil value)
This, unfortunately, doesn't change the jist of the question - I'm not even getting down to the windowinstance as it's bombing-out at the parent subwindow (sw01).
Yeah, I was trying to avoid having to do that (as I said, I was tired) - I was hoping that someone would see an "obvious" mistake that they could point out while I slept - if no-one had found anything then I was going to take your suggested route when I get back to it tomorrow.
Thanks TrenDulux-Oz
√(-1) 2^3 Σ Π
...And it was Delicious!
Alpha-Geek
ICT Professional
GMing Since 1982
NSW, Australia, UTC +10
LinkedIn Profile: www.linkedin.com/in/mjblack
Watch our games on Twitch: www.twitch.tv/dulux_oz
Support Me on Patreon: www.patreon.com/duluxoz
Past Games, etc, on my YouTube Channel: www.youtube.com/c/duluxoz
-
May 16th, 2014, 18:51 #4
Found it!
Forgot to put in a <fastinit /> in my <subwindow> definition.
I REALLY have to stop coding when I'm tired!
CheersDulux-Oz
√(-1) 2^3 Σ Π
...And it was Delicious!
Alpha-Geek
ICT Professional
GMing Since 1982
NSW, Australia, UTC +10
LinkedIn Profile: www.linkedin.com/in/mjblack
Watch our games on Twitch: www.twitch.tv/dulux_oz
Support Me on Patreon: www.patreon.com/duluxoz
Past Games, etc, on my YouTube Channel: www.youtube.com/c/duluxoz
-
May 16th, 2014, 18:54 #5
Firstly, getWindows() won't work against a window instance. A window instance is a single instance of a window, it doesn't have any other windows it is a window in itself. https://www.fantasygrounds.com/refdo...owinstance.xcp
To go back to the jist of your question, I'm not 100% sure as I don't have access to your XML, but I think it is the subwindow.wi1 portion that could be failing. without seeing your XML, I think that subwindow is actually the window instance wi1
See what Debug.console("parentcontrol.window.sw01.subwindow = " .. parentcontrol.window.sw01.subwindow.getClass()); shows you, this might be the window instance you are looking for. But, remember that getWindows will not work on this - you only have one window instance and at this point you probably have the reference to it.Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!
-
May 16th, 2014, 19:42 #6
Gawd, I can't even get my corrects right tonight!
Let's try again - third time's the charm, as they say.
Right, its not a windowinstance nor is it a windowreferencecontrol, it's a windowlist!
Sometimes I should just walk away...
Anyway, as I said in Post #4, I found the issue - I needed to <fastinit /> in my <subwindow> definition.
I've tested it, it works, and now I'm going to bed!
CheersDulux-Oz
√(-1) 2^3 Σ Π
...And it was Delicious!
Alpha-Geek
ICT Professional
GMing Since 1982
NSW, Australia, UTC +10
LinkedIn Profile: www.linkedin.com/in/mjblack
Watch our games on Twitch: www.twitch.tv/dulux_oz
Support Me on Patreon: www.patreon.com/duluxoz
Past Games, etc, on my YouTube Channel: www.youtube.com/c/duluxoz
-
May 16th, 2014, 20:36 #7Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks