[0.17.79] API documentation wrong on guielement.resize_to_sprite?

Bugs that are actually features.
Honktown
Smart Inserter
Smart Inserter
Posts: 1058
Joined: Thu Oct 03, 2019 7:10 am
Contact:

[0.17.79] API documentation wrong on guielement.resize_to_sprite?

Post 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 708 times
I have mods! I guess!
Link
User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5414
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

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

Post 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
Honktown
Smart Inserter
Smart Inserter
Posts: 1058
Joined: Thu Oct 03, 2019 7:10 am
Contact:

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

Post by Honktown »

Had to change some padding and stuff, but specifying the size works for it. Thanks.
Attachments
nice.png
nice.png (27.09 KiB) Viewed 693 times
I have mods! I guess!
Link
Post Reply

Return to “Not a bug”