Skip to content

[#2466] Hack GuiSelector popup fix using string IDs #2484

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 16, 2025

Conversation

oznogon
Copy link
Contributor

@oznogon oznogon commented Jul 4, 2025

Attempt to work around #2466 by assigning string IDs to popups generated by clicking a GuiSelector, then iterating through children of CrewStationScreen and hiding them when changing tabs.

@daid
Copy link
Owner

daid commented Jul 4, 2025

I see how it fixes this specific instance of the problem, but I don't like the hackyness of the solution.

I wonder if somehow the loss of focus on the selector could be used to hide this, as I'm quite sure it will get focus as soon as you open the popup, and loses focus as soon as you click something else.

@oznogon
Copy link
Contributor Author

oznogon commented Jul 4, 2025

I see how it fixes this specific instance of the problem, but I don't like the hackyness of the solution.

I don't like this solution either, but the popup implementation itself is hacky for being parented to the highest-level UI element.

I wonder if somehow the loss of focus on the selector could be used to hide this, as I'm quite sure it will get focus as soon as you open the popup, and loses focus as soon as you click something else.

I had experimented with implementing GuiSelector::onFocusLost() { popup->hide() } before coming to this solution, but onFocusLost() doesn't trigger when the crew screen is changed via keybind.

@daid
Copy link
Owner

daid commented Jul 14, 2025

Beh, yeah, I see why that happens. The whole thing is a bit annoying. Also with the knowledge that in SP2 each widget does know if it is visible or not, while in EE-gui this is implicit. With the focus lost, it does then disappear as soon as you click something else I assume?

@oznogon
Copy link
Contributor Author

oznogon commented Jul 16, 2025

With the focus lost, it does then disappear as soon as you click something else I assume?

No. Even if I click something else, the popup persists until I return to the crew screen containing the selector that created the popup.

If I have clicked something else on a different crew screen, the popup disappears only after I return to the originating crew screen.

If I haven't clicked something else on a different crew screen and then return to the originating crew screen, the popup persists until I click on something else on the originating crew screen.


I've reverted the string check and tried again with GuiSelector::onFocusLost() { popup->hide() } , this time also setting focus(main_panel) in CrewStationScreen::showTab() to force a focus change as if clicked. This seems to work.

@daid
Copy link
Owner

daid commented Jul 16, 2025

Feels like a bit cleaner solution. Still a bit hacky, and possibly some edge cases where you can have a stuck popup. But better then nothing.

@daid daid merged commit 4a2c930 into daid:master Jul 16, 2025
5 checks passed
@oznogon oznogon deleted the 2466-guiselector-popup-persistence branch July 16, 2025 07:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants