-
Notifications
You must be signed in to change notification settings - Fork 39
TextBox show when empty #233
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
Conversation
dhalbert
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes sense. I am kind of surprised at the current behavior: I would have thought it was already going to show the box even if the text was empty. Text as None might have made it go invisible (or use .hidden, if that's available). But this is a good upward-compatible fix.
Do you know of code that depends on this behavior? Should we change the behavior to always display?
|
I had a look through learn project repo. I did find a handful of cases where TextBox is used with a background color and an initial text value of There are a few that I'm not 100% on though. I'll need to test them out on the device to see how they look currently. The background color might be blending in to something behind it which would make the behavior change not matter. Ultimately though I am open to the idea of making it always display the box instead of having an API to set True or False. Any code that doesn't want it to show can always still use |
|
@dhalbert I tested all of the usages of TextBox that I was unsure about from the learn repo. All of them seem to function fine and look the same with "always show when empty" applied. The latest commit removes the API and just makes this the default behavior for TextBox. |
dhalbert
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great - this seems like simpler semantics.
|
could make this a major version release |
Updating https://github.com/adafruit/Adafruit_CircuitPython_Display_Text to 4.0.0 from 3.4.2: > Merge pull request adafruit/Adafruit_CircuitPython_Display_Text#233 from FoamyGuy/textbox_show_when_empty > Merge pull request adafruit/Adafruit_CircuitPython_Display_Text#232 from FoamyGuy/text_box_fix_tilegrid_prop
This adds a new argument and property to
TextBoxthat will cause the background box to remain visible when there is no text in the TextBox if set toTrueIt defaults to
Falseso the behavior is the same by default.I'm using TextBox as an input for the user to click on, and then type into and I want the box to remain visible when it's empty because they haven't typed anything yet, or have erased the text in the box with backspace.