[Solved] Macro: What key is pressed in key down event
-
- Posts: 38
- Joined: Thu Oct 02, 2008 11:53 am
[Solved] Macro: What key is pressed in key down event
I want to write a macro that gets triggered by a "key down" event and reacts depending on what key has been pressed. The "key down" part is easy as the events property of the form control has it, but how do I get the information about WHAT key is down ?
Last edited by mark_orion on Fri Jun 26, 2009 4:36 pm, edited 1 time in total.
OOo 2.4.X on Ubuntu 8.x
Re: Macro needs to know what key is pressed in key down event
I made a text box and set it to trigger a macro on "key down". The macro expected to be passed a parameter oEv. Here is the Macro
When I pressed Shift- A I got this from xray
So oEv.KeyChar is one way to find out what key was pressed.
Code: Select all
Sub Main(oEv)
xray oEv
End Sub
Code: Select all
KeyChar char "A"
KeyCode integer 512
KeyFunc integer 0
Modifiers integer 1
Source object
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
-
- Posts: 38
- Joined: Thu Oct 02, 2008 11:53 am
Re: Macro needs to know what key is pressed in key down event
Works excellent - thank you!FJCC wrote:I made a text box and set it to trigger a macro on "key down". The macro expected to be passed a parameter oEv. Here is the Macro
So oEv.KeyChar is one way to find out what key was pressed.
OOo 2.4.X on Ubuntu 8.x