Hi,
im currently trying to create my own GUI, but its hard and not really documented
So 2 questions:
1. How to instantiate a Filler? Those lined things, that are in the normal uis, where the ui can be dragged. Those agui:Filler objects.
https://pasteboard.co/IgI1sGA.png
2. Is it possible to change things in the "Production Statistics" and the "Trains-Overview" UI? I want to add additional information and dont find a way to manipulate those UIs.
Some questions about GUIs
Re: Some questions about GUIs
No and no.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.
Re: Some questions about GUIs
Hm, thats unfortunate. I have to make it differently
Thanks for the short and precise answer.
Thanks for the short and precise answer.
- eradicator
- Smart Inserter
- Posts: 5211
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: Some questions about GUIs
1) A standard frame will have a visual filler. But you can't use it to drag/drop the window because mod guis can't be moved.
Code: Select all
/c x = game.player.gui.center.add{type='frame',caption='whateverrrr'} x.style.width = 500 x.style.height = 500
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Re: Some questions about GUIs
ok, next question:
I want to have a max-height of around 80% of window-height. How to define a percentage of screen-heigth. Or even better, how to get the current window-height?
I want to have a max-height of around 80% of window-height. How to define a percentage of screen-heigth. Or even better, how to get the current window-height?
- eradicator
- Smart Inserter
- Posts: 5211
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: Some questions about GUIs
You have to divide display_resolution by display_scale btw, or else it'll be wrong if someone plays i.e. on a 4k screen with 200% scale.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Re: Some questions about GUIs
Thanks for the help so far.
Next question:
Does a on_focus event exist? and how can i find out, if an element is focused?
Next question:
Does a on_focus event exist? and how can i find out, if an element is focused?
Re: Some questions about GUIs
No, at least not directly, and you can't. A lot of GUI related stuff (mouse position, cursor position in a text field, the focused element) is not part of the game state and therefore not readable. You can set the focused element using LuaGuiElement.focus().
Re: Some questions about GUIs
Is it possible to change the design of a button? Or set the button to "active" state?