Ability to bring window to the front

Post Reply
User avatar
Therenas
Fast Inserter
Fast Inserter
Posts: 204
Joined: Tue Dec 11, 2018 2:10 pm
Contact:

Ability to bring window to the front

Post 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.

slippycheeze
Filter Inserter
Filter Inserter
Posts: 587
Joined: Sun Jun 09, 2019 10:40 pm
Contact:

Re: Ability to bring window to the front

Post 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.

User avatar
Therenas
Fast Inserter
Fast Inserter
Posts: 204
Joined: Tue Dec 11, 2018 2:10 pm
Contact:

Re: Ability to bring window to the front

Post 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.

slippycheeze
Filter Inserter
Filter Inserter
Posts: 587
Joined: Sun Jun 09, 2019 10:40 pm
Contact:

Re: Ability to bring window to the front

Post 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. :)

User avatar
Therenas
Fast Inserter
Fast Inserter
Posts: 204
Joined: Tue Dec 11, 2018 2:10 pm
Contact:

Re: Ability to bring window to the front

Post 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).

slippycheeze
Filter Inserter
Filter Inserter
Posts: 587
Joined: Sun Jun 09, 2019 10:40 pm
Contact:

Re: Ability to bring window to the front

Post 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. :)

Rseding91
Factorio Staff
Factorio Staff
Posts: 11884
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Ability to bring window to the front

Post 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.
If you want to get ahold of me I'm almost always on Discord.

User avatar
Therenas
Fast Inserter
Fast Inserter
Posts: 204
Joined: Tue Dec 11, 2018 2:10 pm
Contact:

Re: Ability to bring window to the front

Post 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.

User avatar
Therenas
Fast Inserter
Fast Inserter
Posts: 204
Joined: Tue Dec 11, 2018 2:10 pm
Contact:

Re: Ability to bring window to the front

Post by Therenas »

This was added with 1.1.0

Post Reply

Return to “Implemented mod requests”