Page 1 of 1

Make LuaStyle.height/width readable

Posted: Fri Aug 09, 2019 12:42 pm
by Therenas
Currently, you can't read the actual width and height of a GuiElement. With the addition of moveable windows, it would be useful to know the actual sizes of your GuiElements (after stretching, squashing etc, which you can not really predict easily) to be able to set the .location of your windows properly. The LuaStyle.height/width attributes would be a perfect fit for this, as they are currently read only.

Now I don't know for sure how difficult this would be, but that data has to be available somewhere internally, to do auto_center and similar, and to display the size in the Ctrl-F6-debug mode. I would be fine with it only being available on frames, but all Elements would be cool.

Re: Make LuaStyle.height/width readable

Posted: Sat Aug 10, 2019 2:36 am
by Rseding91
That information is not likely to ever be exposed. It's not deterministic which means you can't just read it from Lua. The game would have to detect every time it changed and send an event into the game with what element changed and what the new width/height are.

Re: Make LuaStyle.height/width readable

Posted: Sat Aug 10, 2019 9:05 am
by Therenas
Alright, that is a bit sad to hear, but understandable.

Edit: Just realised I can use a combination of auto_center and .location read to get it to behave how I want (probably)