OpenOffice.org BASIC Guide - OpenOffice.org wiki
OpenOffice.org BASIC Guide - OpenOffice.org wiki
OpenOffice.org BASIC Guide - OpenOffice.org wiki
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Buttons (short)<br />
X (long)<br />
Y (long)<br />
button pressed (one or more constants in accordance with com.sun.star.awt.MouseButton)<br />
X-coordinate of mouse, measured in pixels from the top left corner of the control element<br />
Y-coordinate of mouse, measured in pixels from the top left corner of the control element<br />
ClickCount (long)<br />
number of clicks associated with the mouse event (if <strong>OpenOffice</strong>.<strong>org</strong> can respond fast enough,<br />
ClickCount is also 1 for a double-click because only an individual event is initiated)<br />
The constants defined in com.sun.star.awt.MouseButton for the mouse buttons are:<br />
LEFT<br />
RIGHT<br />
MIDDLE<br />
left mouse button<br />
right mouse button<br />
middle mouse button<br />
The following example outputs the mouse position as well as the mouse button that was pressed:<br />
Sub MouseUp(Event As Object)<br />
Dim Msg As String<br />
Msg = "Keys: "<br />
If Event.Buttons AND com.sun.star.awt.MouseButton.LEFT Then<br />
Msg = Msg & "LEFT "<br />
End If<br />
If Event.Buttons AND com.sun.star.awt.MouseButton.RIGHT Then<br />
Msg = Msg & "RIGHT "<br />
End If<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 />
Note – VBA : The VBA Click and Doubleclick events are not available in <strong>OpenOffice</strong>.<strong>org</strong> Basic. Instead<br />
use the <strong>OpenOffice</strong>.<strong>org</strong> Basic MouseUp event for the click event and imitate the Doubleclick event by<br />
changing 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 />
Events<br />
Both events relate to logical key actions and not to physical actions. If the user presses several keys to output a<br />
single character (for example, to add an accent to a character), then <strong>OpenOffice</strong>.<strong>org</strong> Basic only creates one event.<br />
Chapter 11 · Dialogs 159