improved docs for key-pressed, key-released events

This commit is contained in:
FloVanGH 2024-12-16 15:05:15 +01:00 committed by Simon Hausmann
parent 6a54eb2434
commit 12ec7d1512
2 changed files with 12 additions and 2 deletions

View file

@ -151,6 +151,15 @@ described by the `Point` argument.
### edited()
Invoked when the text has changed because the user modified it.
### key-pressed(KeyEvent) -> EventResult
Invoked when a key is pressed, the argument is a <Link type="KeyEvent" /> struct. Use this callback to
handle keys before `TextInput` does. Return `accept` to indicate that you've handled the event, or return
`reject` to let `TextInput` handle it.
### key-released(KeyEvent) -> EventResult
Invoked when a key is released, the argument is a <Link type="KeyEvent" /> struct. The returned `EventResult`
indicates whether to accept or ignore the event. Ignored events are forwarded to the parent element.
## TextInputInterface
The `TextInputInterface.text-input-focused` property can be used to find out if a `TextInput` element has the focus.

View file

@ -98,8 +98,9 @@ TextEdit {
```
### key-pressed(KeyEvent) -> EventResult
Invoked when a key is pressed, the argument is a <Link type="KeyEvent" /> struct. The returned `EventResult`
indicates whether to accept or ignore the event. Ignored events are forwarded to the parent element.
Invoked when a key is pressed, the argument is a <Link type="KeyEvent" /> struct. Use this callback to
handle keys before `TextEdit` does. Return `accept` to indicate that you've handled the event, or return
`reject` to let `TextEdit` handle it.
### key-released(KeyEvent) -> EventResult
Invoked when a key is released, the argument is a <Link type="KeyEvent" /> struct. The returned `EventResult`