Page 1 of 1

[0.17.79] API documentation wrong on guielement.resize_to_sprite?

Posted: Mon Feb 03, 2020 10:42 am
by Honktown
I added a button to a flow with:

Code: Select all

  flow_buttons.add{type = "sprite-button", name = "button_apply", sprite = "virtual-signal/signal-check"}
Which does make it show up with a green check mark. But it's slightly out of the flow I want it to be in, going outside the frame.

I tried:

Code: Select all

  flow_buttons.button_apply.resize_to_sprite = false
And got this response:
1850.734 Error MainLoop.cpp:*1195: Exception at tick 3628951: Error while running command "testgui": Expected sprite.
note: added * before 1195 so it doesn't show a broken image icon.

https://lua-api.factorio.com/latest/LuaGuiElement.html
resize_to_sprite :: boolean [Read-Write]
Whether should the image widget resize its size according to the sprite in it (true by default)
Why I'm trying to resize the button:
resize.png
resize.png (57.16 KiB) Viewed 709 times

Re: [0.17.79] API documentation wrong on guielement.resize_to_sprite?

Posted: Mon Feb 03, 2020 10:53 am
by Klonan
Thats not how this function works, also thats a sprite-button not a sprite

If you want to set the widget size, use gui.style.width and gui.style.height

Re: [0.17.79] API documentation wrong on guielement.resize_to_sprite?

Posted: Mon Feb 03, 2020 11:24 am
by Honktown
Had to change some padding and stuff, but specifying the size works for it. Thanks.