Opened 5 years ago
Last modified 5 years ago
#5369 new defect
JSInterface GUIPage - Allow parent GUI page to update a child GUI page
Reported by: | elexis | Owned by: | |
---|---|---|---|
Priority: | Should Have | Milestone: | Backlog |
Component: | Core engine | Keywords: | |
Cc: | Patch: |
Description
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.
For example in r18078 / Phab:rP18078#inline-2604 added that the AI configuration dialog is updated with the new settings if the host has changed the settings.
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);
Change History (4)
comment:4 by , 5 years ago
In r22588:
Move CGUIManager::LoadPage
to CGUIManager::SGUIPage::LoadPage
, because it only operates only on that struct.
Refs Phab:D1684 (patch also made an appearance in Phab:D2108)
Preliminaries:
m_CurrentGUI
workaround from r7769 / Phab:rP7769#inline-2607 and implement the function from r7214 without the logic issueTook a solid week to remove this JS workaround, but I think the code is much cleaner and extensible afterwards.