Browse Source

Make sample more concise and to the point.

pull/3988/head
Sebastian 6 months ago committed by GitHub
parent
commit
6cc3351870
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      tutorials/Keyboard/README.md

2
tutorials/Keyboard/README.md

@ -171,4 +171,4 @@ fun App() {
TextFields in Compose for Desktop consume special events of type `java.awt.event.KeyEvent.KEY_TYPED`. If you want to avoid consuming Events that have already been consumed by a TextField, you have to check for this special eventType, as TextFields will not consume `KeyEventType.KeyDown` or `KeyEventType.KeyUp` events on Desktop. TextFields in Compose for Desktop consume special events of type `java.awt.event.KeyEvent.KEY_TYPED`. If you want to avoid consuming Events that have already been consumed by a TextField, you have to check for this special eventType, as TextFields will not consume `KeyEventType.KeyDown` or `KeyEventType.KeyUp` events on Desktop.
You can do this using a condition like `keyEvent.isTypedEvent && keyEvent.awtEventOrNull?.keyChar == 'a'` where `isTypedEvent` uses the `actual val KeyEvent.isTypedEvent: Boolean` in `TextFieldKeyInput.desktop.kt`. In desktop code you can check this using `keyEvent.isTypedEvent` where `isTypedEvent` uses the `actual val KeyEvent.isTypedEvent: Boolean` in `TextFieldKeyInput.desktop.kt`.

Loading…
Cancel
Save