Using LO version 6.0.7.3, Ubuntu 18.04.3.
When I run the below macro in Impress with the msgbox commented out, then pressing a key causes a Fatal Error: Type coercion failed: TYPE is not supported!
However if the msgbox is not commended out, then the code runs almost fine (except that I get repeated message boxes for a single key press, that I cannot explain either.)
I would be very grateful to anyone who can explain to me why this is happening.
REM LO BASIC
Global oController
Global oKeyHandler
Global oPresentation
Sub Main
oController = ThisComponent.getCurrentController
oKeyHandler = createUnoListener( "KeyHandler_", "com.sun.star.awt.XKeyHandler" )
oController.addKeyHandler( oKeyHandler )
oPresentation = ThisComponent.Presentation
oPresentation.start()
End Sub
Function KeyHandler_keyPressed( oEvent ) as Boolean
If oEvent.keyCode = com.sun.star.awt.Key.A Then
REM msgbox "A was pressed"
KeyHandler_keyPressed = true
ElseIf oEvent.keyCode <> com.sun.star.awt.Key.A Then
REM msgbox "Not A was pressed"
KeyHandler_keyPressed = false
End If
End Function