Brendan Campbell-hartzell
06/24/2022, 6:36 PMIgor Demin
06/29/2022, 9:27 PMBrendan Campbell-hartzell
06/29/2022, 10:55 PMIgor Demin
06/29/2022, 11:18 PMSwingPanel(Modifier.onPreviewKeyEvent = {}, factory = ::SomeSwingComponent)
And clicks on SomeSwingComponent and key presses when SomeSwingComponent is in focus aren’t caught by the upper modifier.
Yes, this isn’t implemented unfortunately. The swing event handling tree is detached from the Compose event handling tree at the moment, and the only way to catch the events on the Swing component is to set listeners manually.
But I will investigate in the future, if it is possible to make a seamless event tree for Swing/Compose components.Igor Demin
06/29/2022, 11:28 PMIs it not possible to see what modifiers were received and work with them manuallyThere can be not only modifiers on SwingPanel, but also on some upper component:
Box(Modifier.onPreviewKeyEvent) {
SwingPanel
}
Such configuration isn’t supported too, and there is no way to pass the event to this modifier, because the event system in Swing doesn’t know about this Compose component, and connecting the Swing event system to this component is probably only possible inside the internals of Compose.Brendan Campbell-hartzell
06/30/2022, 1:06 AMon<SomeEvent>
- style inputs that I could end up using in the update method for the SwingPanel. It works, but it sort of breaks the interface from an external user's perspective. It'd be nice if we could inspect the Modifier object for the types that were passed in so that, when creating custom components, we could decide that certain parts of the modifier should be passed to some subcomponent while another is passed to something else.