Ask Your Question
1

Is there a function to take a single character from the keyboard?

asked 2015-04-24 16:55:41 +0200

riq.willitts gravatar image

Using a LibreOffice form containing a listbox, I can easily set up an event on the listbox to call a Basic macro when a key is released. However there does not seem to be any way for this macro to find out which key was pressed.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2015-04-25 11:45:00 +0200

pierre-yves samyn gravatar image

Hi - You can do:

Sub InfoKey(oEvent)

dim sMsg as string

with oEvent
    sMsg = "Modifiers: " & .Modifiers & chr(13)
    sMsg = sMsg & "KeyCode: " & .KeyCode & chr(13)
    sMsg = sMsg & "KeyChar: " & .KeyChar & chr(13)
    sMsg = sMsg & "KeyFunc: " & .KeyFunc
end with

msgbox sMsg

End Sub

See API info.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2015-04-24 16:55:41 +0200

Seen: 49 times

Last updated: Apr 25 '15