21.08.2013 Views

OpenOffice.org BASIC Guide - OpenOffice.org wiki

OpenOffice.org BASIC Guide - OpenOffice.org wiki

OpenOffice.org BASIC Guide - 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<br />

The Assign Action dialog lists all of the available Events. To assign a macro to an event:<br />

1. Select the event<br />

2. Click Macro...<br />

3. Browse to and select the macro you want to assign<br />

4. Click OK<br />

Parameters<br />

The occurrence of a particular event is not always enough for an appropriate response. Additional information<br />

may be required. For example, to process a mouse click, you may need the screen position where the mouse<br />

button was pressed.<br />

In <strong>OpenOffice</strong>.<strong>org</strong> Basic, you can use object parameters to provide more information about an event to a<br />

procedure, for example:<br />

Sub ProcessEvent(Event As Object)<br />

End Sub<br />

The structure and properties of the Event object depend on the type of event that triggers the procedure call.<br />

Regardless of the type of event, all objects provide access to the relevant control element and its model. The<br />

control element can be reached using Event.Source and its model using Event.Source.Model.<br />

You can use these properties to trigger an event within an event handler.<br />

Mouse Events<br />

<strong>OpenOffice</strong>.<strong>org</strong> Basic recognizes the following mouse events:<br />

Mouse moved<br />

user moves mouse<br />

Mouse moved while key pressed<br />

user drags mouse while holding down a key<br />

Mouse button pressed<br />

user presses a mouse button<br />

Note – This event is also used for notifying requests for a popup context menu on the control. In this case, the<br />

member PopupTrigger of the event passed to your macro function will be TRUE. In particular, if such a request<br />

is made by pressing the right mouse button on the control, the event will be fired twice: once for the popup menu<br />

request, and once for the real mouse event. If you are interested in only the mouse click, your macro should<br />

ignore all calls where PopupTrigger is TRUE.<br />

Mouse button released<br />

user releases a mouse button<br />

Mouse outside<br />

user moves mouse outside of the current window<br />

The structure of the associated event objects is defined in the com.sun.star.awt.MouseEvent structure which<br />

provides the following information:<br />

158 <strong>OpenOffice</strong>.<strong>org</strong> 3.2 <strong>BASIC</strong> <strong>Guide</strong> · March 2010

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

Saved successfully!

Ooh no, something went wrong!