-
-
Notifications
You must be signed in to change notification settings - Fork 690
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Label's updated text won't be displayed on Android unless "refresh()" gets called explicitly #1289
Comments
I can repro a bug similar to this - if you use a button to set the text on an Android The solution seems to be to change Toga Android's call to Android EditText's |
@Dominik1123 hmm - I just tried to reproduce this again today, and I couldn't. Can you test with this test repo? https://github.com/paulproteus/toga-issue-1289 When I click the button, the label text changes. Code: Before click: After click: |
@paulproteus From the look of it, the text is updating, but the layout isn't reflecting the new shorter length. That is a bug in itself; but is it possible that if the "new" text is longer than the original, the behavior might be different? |
@mhsmith Seems like this might be fixed by your recent work in this area; tagging so we don't forget to close this one when we land the fixes you're working on. |
This will mostly be fixed by #1794, but I'll leave it open for now because there was a corner case where making the text longer updates the layout, and the label actually expands (as shown by its background color), but the text is wrapped at the previous width. The corner case was discovered at #1708 (review): "The second last slider [in examples/slider] doesn't appear to report correctly for values <0 or >9". Specifically, the number was disappearing from the label when it went out of that range. I found this was because those numbers had more than one character, making the string wider, and the label was cutting off the last word, even though there was plenty of space for it. The problem was that we're calling I was able to fix this by calling I never committed any of that because I got diverted onto looking at #1794, and after that was merged, the examples/slider truncation problem wasn't happening anymore. However, the issue was dependent on the exact ordering of labels getting shorter and longer (I shortened some of them while testing to fit on a mobile-sized screen), and it may even be affected by the length of other labels in the same layout. So I'm not confident that the problem is really gone, and it's probably safer to put the For how to test this, see #1824. |
Describe the bug
I create a
label = toga.Label()
whose text I then modify dynamically (based on user input). I do this vialabel.text = '...'
. This works on Linux however the updated text won't show on Android. If I explicitly calllabel.refresh()
then the updated text also shows on Android.To Reproduce
Steps to reproduce the behavior:
text = toga.TextInput()
field and alabel = toga.Label()
. In the text input'son_change
method, just copy the current value of the field to the label vialabel.text = text.value
.label.refresh()
is called explicitly.Expected behavior
The updated text should show automatically.
Environment:
The text was updated successfully, but these errors were encountered: