From 41457640cf9a0556324810acc95e833962d08341 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Mon, 7 Aug 2023 19:36:08 +0800 Subject: [PATCH] Add textinput event handlers. --- textual/src/toga_textual/widgets/textinput.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/textual/src/toga_textual/widgets/textinput.py b/textual/src/toga_textual/widgets/textinput.py index 07bb95c618..24477830cc 100644 --- a/textual/src/toga_textual/widgets/textinput.py +++ b/textual/src/toga_textual/widgets/textinput.py @@ -9,6 +9,15 @@ def __init__(self, impl): self.interface = impl.interface self.impl = impl + def on_focus(self, event: TextualInput.Changed) -> None: + self.interface.on_gain_focus(None) + + def on_input_changed(self, event: TextualInput.Changed) -> None: + self.interface.on_change(None) + + def on_input_submitted(self, event: TextualInput.Submitted) -> None: + self.interface.on_submit(None) + class TextInput(Widget): def create(self):