[0.9.8] .text property change isn't visible until reload.
Posted: Mon Jun 16, 2014 1:40 pm
There is some quirkiness in textfield element. It has two string fields text and caption. Latest factorio update (0.10.0) reminded me of it, because there is some change on element.add() -method that broke my mod.
Creation of element:
Current usage:
When user edits the textfield, the text is saved in "text" -field.
Script can read and write both fields, but only when adding value to caption -field it has visible effect on screen.
Some interesting usage.
Creation of element:
Code: Select all
element.add({ type="textfield", name="test", style=style, text = "0", caption ="1" })
--element.test.caption is "1"
--element.test.text is ""
--the textfield on screen is empty
When user edits the textfield, the text is saved in "text" -field.
Script can read and write both fields, but only when adding value to caption -field it has visible effect on screen.
Some interesting usage.
Code: Select all
--Overwriting user inputs. Basicly "locks" textfield if used ontick.
element.test.caption = element.test.caption