Page 1 of 1
Some questions about GUIs
Posted: Tue May 28, 2019 12:06 am
by asdff45
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.
Re: Some questions about GUIs
Posted: Tue May 28, 2019 4:52 am
by Bilka
No and no.
Re: Some questions about GUIs
Posted: Tue May 28, 2019 11:22 pm
by asdff45
Hm, thats unfortunate. I have to make it differently
Thanks for the short and precise answer.
Re: Some questions about GUIs
Posted: Fri May 31, 2019 7:28 pm
by eradicator
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
Re: Some questions about GUIs
Posted: Sat Jun 01, 2019 1:26 am
by asdff45
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?
Re: Some questions about GUIs
Posted: Sat Jun 01, 2019 5:59 am
by eduran
Re: Some questions about GUIs
Posted: Sat Jun 01, 2019 7:50 am
by eradicator
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.
Re: Some questions about GUIs
Posted: Wed Jun 12, 2019 2:07 pm
by asdff45
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?
Re: Some questions about GUIs
Posted: Wed Jun 12, 2019 2:18 pm
by eduran
asdff45 wrote: ↑Wed Jun 12, 2019 2:07 pm
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?
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
Posted: Thu Jun 13, 2019 11:16 pm
by asdff45
Is it possible to change the design of a button? Or set the button to "active" state?