Make .enabled work on frames

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Post Reply
User avatar
Therenas
Factorio Staff
Factorio Staff
Posts: 208
Joined: Tue Dec 11, 2018 2:10 pm
Contact:

Make .enabled work on frames

Post by Therenas »

We now have the ability to do moveable windows, which is great. What this allows is to have true 'pop-up' windows that are overlaid on your base interface. This is obviously nicer than having to hide the main interface when the dialog is open, and show it again when the dialog is closed.

Now one problem with this approach is that the user could still click things on the main interface when the dialog is open, which might be bad for data consistency and such, because existing mods don't expect them to be able to do this. It would be a lot of work to correct/prevent this.

A solution employed elsewhere is to make the main window unclickable when a dialog is open. You can currently do this with .ignored_by_interaction. This is fine, but it doesn't convey to the user that he needs to close the dialog to be able to use the main interface again. What would be great if setting .enabled on a frame would work, and 'disable' the frame you set it on.

I imagine that the effects would be a dimming of the whole frame, like a grey overlay (similar to this). In addition, the frame could display it's tooltip whenever you hover over it, so modders can set a message explaining what is going on, if they want to. It could also play an error-like sound when you click on it, to further emphasize the disabled-state of the frame.

User avatar
Therenas
Factorio Staff
Factorio Staff
Posts: 208
Joined: Tue Dec 11, 2018 2:10 pm
Contact:

Re: Make .enabled work on frames

Post by Therenas »

I want to bump this thread because a user just made me realise another disadvantage to .enabled not working on frames. When I use the current method of setting .ignored_by_interaction, the user can't click on anything on the frame, but their click goes 'through' to whatever is below it, which might some vanilla interface or some entity. This is obviously not very intuitive. If .enabled worked on frames so that it would catch any click on the interface and just make it not do anything, that would be great. So it'd work the same as .ignored_by_interaction, except that the click wouldn't be able to 'pass through'.

(I know that the engine is not really laid out to support overlapping windows, but this seems like a reasonable request in general.)

User avatar
Therenas
Factorio Staff
Factorio Staff
Posts: 208
Joined: Tue Dec 11, 2018 2:10 pm
Contact:

Re: Make .enabled work on frames

Post by Therenas »

Going to bump this again, is it possible to simply have it so that setting .enabled = false on frame makes it behave the same way as if you set ignored_by_interaction = true, with the difference being that the click does not go 'through' the frame, possibly activating something behind it? I would really appreciate it.

Post Reply

Return to “Modding interface requests”