JSInterface GUIPage - Allow parent GUI page to update a child GUI page
|Reported by:||elexis||Owned by:|
In some cases, a GUI page opens a child GUI page, and the information on that child page has to be updated if an event in the parent GUI page was handled.
Another example would be the network window #3787 that has to be updated whenever g_GameAttributes or g_PlayerAssignments changes.
Closing the dialog, assembling the last user selection and choices, passing that to the parent page and opening a new dialog with the new data and the old settings seems like a workaround. The existing window should be updated instead of closed and reopened. (It could even be visible to the user if the renderer would render independently).
This way, the child GUI page could keep it's data localized, rather than "poisoning" the parent GUI page with information it ought to be agnostic of.
A third example could be the session dialogs (for example diplomacy dialog). They are currently implemented as a GUIObject rather than a GUIPage (this pattern is not possible for every dialog, as for example the network dialog should be openable from multiple pages).
var g_ChildPage = Engine.PushGuiPage(oldData); g_ChildPage.updateSomething(newData);