[Wheybags] [0.17.77] changing style.font for textfields does not cause redrawing

This subforum contains all the issues which we already resolved.
Post Reply
User avatar
jan1i3
Long Handed Inserter
Long Handed Inserter
Posts: 59
Joined: Sun Dec 09, 2018 1:36 pm
Contact:

[Wheybags] [0.17.77] changing style.font for textfields does not cause redrawing

Post by jan1i3 »

When changing the font of a textfield after it has already been drawn, the text does not get redrawn with the new font until something else causes it to redraw (like after the user types a character for example).

(one can also say "the change has no effect - yet", "it is delayed")
yes, happens reliably every time.

(expected: the font should update instantly)

steps to reproduce:
1. create a new world

2. run

Code: Select all

/c
game.player.gui.screen
  .add{type = "frame", name = "demo", caption = "demo"}
  .add{type = "textfield", name = "tf", text = "text"}
3. then in a later tick run

Code: Select all

/c game.player.gui.screen.demo.tf.style.font = "default-bold"
4. press control + f6
5. hover over the text box, it shows font "default-bold", but visually is "default"
6. focus the textfield
7. remove 1 char
8. the font changes visually to "default-bold"

alternatively, after 5. run

Code: Select all

/c game.player.gui.screen.demo.tf.text = "text"
(does not change the font visually)
then run

Code: Select all

/c game.player.gui.screen.demo.tf.text = "tex"
(does change it, because it's a different text)

or

Code: Select all

/c game.player.gui.screen.demo.tf.style.color = {1, 0, 0}
works too

state at step 5.:
bad-state.png
bad-state.png (62.29 KiB) Viewed 3431 times

state at end:
fixed-state.png
fixed-state.png (13.16 KiB) Viewed 3431 times
Attachments
factorio-current.log
(5.19 KiB) Downloaded 115 times
Also known as JanSharp. jan1i3 was/is my old name ;)

User avatar
wheybags
Former Staff
Former Staff
Posts: 328
Joined: Fri Jun 02, 2017 1:50 pm
Contact:

Re: [Wheybags] [0.17.77] changing style.font for textfields does not cause redrawing

Post by wheybags »

Thanks for the report! It's always nice when someone includes simple lua commands to replicate the issue, instead of a massive mod list and instructions, or something like that :D
Fixed for 1.1.

User avatar
jan1i3
Long Handed Inserter
Long Handed Inserter
Posts: 59
Joined: Sun Dec 09, 2018 1:36 pm
Contact:

Re: [Wheybags] [0.17.77] changing style.font for textfields does not cause redrawing

Post by jan1i3 »

You're welcome, and thanks for the fix :)
Also known as JanSharp. jan1i3 was/is my old name ;)

Post Reply

Return to “Resolved Problems and Bugs”