Textarea focus from textbox/input bug

I think this is a bug.

def textbox_pressed_enter(self, **event_args):
    self.textarea.focus()

leads to pressing enter twice inside a textarea.
The workaround i’ve come up with is to sleep for 0.01 seconds…

https://anvil.works/build#clone:D5CTEXPWRNPYP3TX=NVPERHGWBLR7OF7U6XHIHNNC

1 Like

Thanks for another really clear bug report. Everybody loves race conditions! Moved to Bug Reports.

The focus() doesn’t works works when the form loads. The text box doesn’t get focus
Clicking the button does the trick, but self.button_1_click() doesn’t

def __init__(self, **properties):
    # Set Form properties and Data Bindings.
    self.init_components(**properties)
    sleep(.01)
    self.text_box_1.focus()    

do that on the form_show event. I don’t think you can focus something that’s not yet on the screen…

1 Like

Thanks @stucork, I got it. My bad