PDA

View Full Version : finding current parent window for child windowlist control?



MeepoSose
September 9th, 2009, 19:30
Okay, I am having a hard time finding the current character sheet from within a script. Any suggestions?

Scenario:
1. Character Sheet has a field "myField" which is a stringcontrol
2. Character Sheet has a windowlist with an onInit that creates a bunch of new windows for display in the list.
3. Within the onClickDown event of a list item, I want to update "myField" with the value of the list item.

Foen
September 9th, 2009, 21:59
From within the list item, 'windowlist' references the containing list, and from within any control, 'window' references the conatining window. Therefore 'windowlist.window' gets you from a list item to the host window, and 'windowlist.window.myField' then navigates to the control you're after (I hope).

Foen

MeepoSose
September 9th, 2009, 22:29
From within the list item, 'windowlist' references the containing list, and from within any control, 'window' references the conatining window. Therefore 'windowlist.window' gets you from a list item to the host window, and 'windowlist.window.myField' then navigates to the control you're after (I hope).

Foen


Awesome, thanks. I needed to do "window.windowlist.window.myField" for some reason, but that worked fine. Now I just need to come up with a convenient way to store the target field when I create the list item.

Foen
September 9th, 2009, 22:45
Sounds like you weren't trying to access myField from the list item, but from a control *within* the list item, in which case the first step is to reference the list item itself from the control, then to do the rest.

There is another way too, using the database structure, and you can find some info on it on this thread:

https://www.fantasygrounds.com/forums/showthread.php?t=7248

Hope that helps

Stuart