Getting Started Guide

Menu item
Use Tools > Customize to open the Customize dialog, and select the Menus tab. You
can modify an existing menu, or create new menus that call macros. For more about
modifying menus, see Chapter 14.
Keyboard shortcuts
Use Tools > Customize to open the Customize dialog, and select the Keyboard tab.
Assigning keyboard shortcuts is discussed in Chapter 14.
Event
In OpenOffice.org, when something happens, we say that an event occurred. For
example, a document was opened, a key was pressed, or the mouse moved.
OpenOffice.org allows events to cause a macro to be called; the macro is then called
an event handler. Full coverage of event handlers is well beyond the scope of this
document, but a little knowledge can accomplish much.
Caution
Be careful when you configure an event handler. For example,
assume that you write an event handler that is called every time that
a key is pressed, but you make a mistake so the event is not properly
handled. One possible result is that your event handler will consume
all key presses, forcing you to forcibly terminate OpenOffice.org.
Use Tools > Customize to open the Customize dialog, and select the Events tab (see
Figure 311). The events in the Customize dialog are related to the entire application
and specific documents. Use the Save In box to choose OpenOffice.org, or a specific
document.
A common use is to assign the Open Document event to call a specific macro. The
macro then performs certain setup tasks for the document. Select the desired event
and click the Macro button to open the Macro Selector dialog (see Figure 312).
Select the desired macro and click OK to assign the macro to the event. The Events
tab shows that the event has been assigned to a macro (see Figure 313). When the
document opens, the PrintHello macro is run.
Many objects in a document can be set to call macros when events occur. The most
common usage is to add a control, such as a button, into a document. Even double-
clicking on a graphic opens a dialog with a Macros tab that allows you to assign a
macro to an event.
340 Getting Started with OpenOffice.org 3.3