REM ***** BASIC *****
Sub subAddKeyHandler
oDoc = ThisComponent.CurrentController
oKeyHandler = createUnoListener("funKeyHandler_", "com.sun.star.awt.XKeyHandler")
oDoc.addKeyHandler(oKeyHandler)
End Sub
Function funKeyHandler_keyPressed(aEvent) As Boolean
msgbox aEvent.KeyCode
End Function
Function funKeyHandler_keyReleased(aEvent) As Boolean
End Function
Function funKeyHandler_disposing
oDoc.removeKeyHandler(oKeyHandler)
End Function
Sub subAddKeyHandler
oDoc = ThisComponent.CurrentController
oKeyHandler = createUnoListener("funKeyHandler_", "com.sun.star.awt.XKeyHandler")
oDoc.addKeyHandler(oKeyHandler)
End Sub
Function funKeyHandler_keyPressed(aEvent) As Boolean
msgbox aEvent.KeyCode
End Function
Function funKeyHandler_keyReleased(aEvent) As Boolean
End Function
Function funKeyHandler_disposing
oDoc.removeKeyHandler(oKeyHandler)
End Function
本文介绍如何利用UNO Listener在组件间传递键事件,通过创建并添加自定义键处理器来响应按键操作。
1613

被折叠的 条评论
为什么被折叠?



