Page 1 of 1

Ability to bring window to the front

Posted: Fri Aug 09, 2019 1:15 pm
by Therenas
As far as I can tell, windows are currently layered according to their age, with younger/more recent windows layered on top of older ones. This makes sense, but can lead to problems. In my case, I have multiple windows added to LuaGui.screen whose visibility is toggled all the time. I don't want to recreate them every time for performance reasons. But, sometimes one of them has to be recreated to incorporate new user settings or similar. Then, it will always show up on top, even though others should logically always layer over them (because they are smaller and pop-ups to the big window).

My proposed solution to this is to have a method on the elements that can be in LuaGui.screen that brings them specifically to the front, so I can manage the layering myself. But if there is a different solution to my problems, I would be all ears.

Re: Ability to bring window to the front

Posted: Fri Aug 09, 2019 11:18 pm
by slippycheeze
Therenas wrote:
Fri Aug 09, 2019 1:15 pm
But if there is a different solution to my problems, I would be all ears.
Call LuaGuiElement.clear on the content of the window, recreate the insides but not the window itself? Should, if the documentation is correct, resolve the issue.

Possibly, also, simply reconstruct a smaller area of the window, if only part of it changes in response to whatever the user did.

Re: Ability to bring window to the front

Posted: Sat Aug 10, 2019 9:09 am
by Therenas
I mean I could probably do that, in my case the frame dimensions change, so everything has to 're-draw'. My code is currently not really laid out to work this way, but you are right that it would be a solution. Even so, I feel like the requested feature should exist in general (for other purposes), because it makes sense, but I'm not sure how convincing that is to the devs.

Re: Ability to bring window to the front

Posted: Mon Aug 12, 2019 8:57 pm
by slippycheeze
Therenas wrote:
Sat Aug 10, 2019 9:09 am
I mean I could probably do that, in my case the frame dimensions change, so everything has to 're-draw'. My code is currently not really laid out to work this way, but you are right that it would be a solution. Even so, I feel like the requested feature should exist in general (for other purposes), because it makes sense, but I'm not sure how convincing that is to the devs.
I respect that. I don't think this is a bad plan, or whatever, I just figured that you asked for other ways, and that was the one that came immediately to mind from my days back in prehistory working on abstractions over GUI toolkits on multiple platforms. It was also horrible then, of course. :)

Re: Ability to bring window to the front

Posted: Mon Aug 12, 2019 9:04 pm
by Therenas
Of course, I'm grateful that you did, it wasn't hard to make it work that way actually, so I'm happy (mostly).

Re: Ability to bring window to the front

Posted: Tue Aug 13, 2019 3:45 pm
by slippycheeze
Therenas wrote:
Mon Aug 12, 2019 9:04 pm
Of course, I'm grateful that you did, it wasn't hard to make it work that way actually, so I'm happy (mostly).
Heh, I'm glad. Text is very hard to read emotional content from, and I thought you were grumpy, not happy. One time I'm happy to be wrong. :)

Re: Ability to bring window to the front

Posted: Wed Aug 14, 2019 3:05 am
by Rseding91
I really don't want to add this because mods should not be using player.screen to to try to make layered windows. It specifically does not pay any attention to z ordering of things in player.screen and they end up what ever they end up. It's purpose was not layered windows and in fact layered windows is completely outside of what we even support in Factorio GUI.

Either a GUI is all one piece or completely separate and can be moved independent from each other.

Re: Ability to bring window to the front

Posted: Wed Aug 14, 2019 10:11 am
by Therenas
Rseding91 wrote:
Wed Aug 14, 2019 3:05 am
I really don't want to add this because mods should not be using player.screen to to try to make layered windows. It specifically does not pay any attention to z ordering of things in player.screen and they end up what ever they end up. It's purpose was not layered windows and in fact layered windows is completely outside of what we even support in Factorio GUI.

Either a GUI is all one piece or completely separate and can be moved independent from each other.
Thanks for the reply. I guess it's reasonable to not support layered windows as something that .screen is supposed to do. Although adding the requested ability solves most of the issues I can think of with layered windows, so it might be worth it if it's not difficult to implement? You be the judge of course.

Re: Ability to bring window to the front

Posted: Sun Apr 25, 2021 8:20 pm
by Therenas
This was added with 1.1.0