21.08.2013 Views

OpenOffice.org BASIC Guide.pdf - OpenOffice.org wiki

OpenOffice.org BASIC Guide.pdf - OpenOffice.org wiki

OpenOffice.org BASIC Guide.pdf - OpenOffice.org wiki

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Events 219<br />

If Event.Buttons AND com.sun.star.awt.MouseButton.MIDDLE Then<br />

Msg = Msg & "MIDDLE "<br />

End If<br />

Msg = Msg & Chr(13) & "Position: "<br />

Msg = Msg & Event.X & "/" & Event.Y<br />

MsgBox Msg<br />

End Sub<br />

The VBA Click and Doubleclick events are not available in <strong>OpenOffice</strong>.<strong>org</strong> Basic. Instead use the<br />

<strong>OpenOffice</strong>.<strong>org</strong> Basic MouseUp event for the click event and imitate the Doubleclick event by changing<br />

the application logic.<br />

Keyboard Events<br />

The following keyboard events are available in <strong>OpenOffice</strong>.<strong>org</strong> Basic:<br />

Key pressed<br />

user presses a key.<br />

Key released<br />

user releases a key<br />

Both events relate to logical key actions and not to physical actions. If the user presses<br />

several keys to output a single character (for example, to add an accent to a character),<br />

then <strong>OpenOffice</strong>.<strong>org</strong> Basic only creates one event.<br />

A single key action on a modification key, such as the Shift key or the Alt key does not<br />

create an independent event.<br />

Information about a pressed key is provided by the event object that <strong>OpenOffice</strong>.<strong>org</strong> Basic<br />

supplies to the procedure for event handling. It contains the following properties:<br />

KeyCode (short)<br />

code of the pressed key (default values in accordance with<br />

com.sun.star.awt.Key<br />

)<br />

KeyChar (String)<br />

character that is entered (taking the modification keys into consideration)<br />

The following example uses the KeyCode property to establish if the Enter key, the Tab key,<br />

or one of the other control keys has been pressed. If one of these keys has been pressed,<br />

the name of the key is returned, otherwise the character that was typed is returned:<br />

Sub KeyPressed(Event As Object)<br />

Dim Msg As String

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!