I am trying ta make a text dialog popup box as you'll see in many GUI's since time immemorial. As in:
- event happens,
- popup box shows up with a text area in it, such that
- You start typing and your text appears in the text box.
I have implemented a Popup with a TextInput inside of it.
...What I want is that be no action required by the user to direct focus to my dialog box. Focus is there when the text area (aka, "TextInput" in Kivy) appears in the dialog box ("Popup" in Kivy).
I notice that the recommended method of automatically assigning focus to a Popup is to use on_parent(). However, at the time the Popup gets an on_parent event, the TextInput is not created. And when the Popup is instantiated, its child TextInput gets an on_parent first... the Popup's on_parent is called later (seen from print statements). So the TexitInput can never get focus because it's not yet in view. It appears that we have a Catch-22 in there.
I notice, too, that I could schedule an event a short time after instantiating my Popup, but that seems like a kludge. Who's to say that the everything is ready 0.2 or 0.3 or 0.4 seconds after the Popup is instantiated? I really loathe random delays in an environment that should be controlled and knowable; it points to a deficiency in my opinion. And even if I do set a timer, who's to say that it will work properly on a system that's somehow loaded or otherwise in a funky (yet recoverable) state?
Any suggestions would be appreciated.