Help closing a popup window

Thomdar

Chieftain
Joined
Sep 8, 2011
Messages
7
Location
Nanaimo
I'm currently working on a mod where I want to close windows without modifying the lua file for the popup. So far it works except for one popup window - TechPopup.lua.

This is the window that opens on the left side either when you have to choose a new research or if you click on the InfoCorner/TechPanel heading button.

The commands I used to close some windows is

UIManager : DequeuePopup(LookUpControl( "InGame/GoodyHutPopup"));

This works for all popups I've tested except for CityView, ProductionPopup and TechPopup. I solved CityView and ProductionPopup by using the following

LookUpControl("InGame/ProductionPopup"):SetHide (true);
Events.SerialEventExitCityScreen();

I have yet to find a command that closes the TechPopup. "InGame/TechPopup" isn't the correct context reference for the window and so far none of the following work:

"InfoCorner/TechPopup"
"InfoCorner/TechPanel/TechPopup"
"TechPanel/TechPopup"
"TechPopup"
"UI/TechPopup"

Looking to see if anyone has dealt with a similar problem and knows the proper reference to use for TechPopup.
 
I think its TechBackground.

In the lua for the tech popup, theres this as well:

Code:
-------------------------------------------------
-- Close this popup
-------------------------------------------------
function ClosePopup()
	CloseAdvisorPopup(ButtonPopupTypes.BUTTONPOPUP_CHOOSETECH);
	ContextPtr:SetHide( true );
	Events.SerialEventGameMessagePopupProcessed(ButtonPopupTypes.BUTTONPOPUP_CHOOSETECH, 0);
end
 
Thanks Sneaks for your suggestion but unfortunately it didn't work for me. Thankfully it seems I just needed to sleep on it. Two minutes after hitting the pillow an idea came to me but I resisted turning the computer back on to try it. The answer is sadly obvious considering what I was doing all day to close other popups. I just had to follow the control from InGame to TechPopup through the xml LuaContext chain (InGame -> WorldView -> InfoCorner -> TechPanel -> TechPopup. I was close before but just didn't get the full chain in my code or fire tuner testing. You can close TechPopup from an InGame UI addin as follows:

Code:
LookUpControl ( "InGame/WorldView/InfoCorner/TechPanel/TechPopup" ) : SetHide ( true)

With this I can now probably control most UI controls (turning off and on) at will as long as there is a chain of controls from InGame to the window in question. Now I just need to find all the commands that work with LookUpControl. I know SetHide ( bool ) and IsHidden (). Any place I can look up these? Guess I can look through vanilla code for any ideas.
 
Back
Top Bottom